-
Notifications
You must be signed in to change notification settings - Fork 3
jQuery datagridview defaults and options
Maikel Bos edited this page Aug 24, 2019
·
14 revisions
The jQuery-datagridview is created with ease of use in mind. Almost all options can be configured using data-attributes. However, sometimes there is a need to override the options explicitly or influence the default behaviour. This is possible both by changing the default options, and by explicitly passing the options when first creating the datagridview.
All defaults and options are defined as functions to make them as flexible as possible.
<div id="example-table" class="select multiselect">
</div>
<script type="text/javascript">
// Override the default to look at the class instead of the data-attribute
$.fn.datagridview.defaults.allowSelect = function() {
return $(element).hasClass('select');
}
$.fn.datagridview.defaults.isMultiselect = function() {
return $(element).hasClass('multiselect');
}
// For this specific datagridview, simply create a single-select grid even though it has the `multiselect` class
$('#example-table').datagridview({
isMultiselect: function(element) {
return false;
}
});
</script>