-
Notifications
You must be signed in to change notification settings - Fork 3
jQuery datagridview defaults and options
Maikel Bos edited this page Dec 28, 2020
·
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.
Text resources are also supplied via this mechanism, under the property resources
under the defaults and options objects. For more information on this, see text and internationalization.
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(element) {
return $(element).hasClass('select');
}
$.fn.datagridview.defaults.isMultiselect = function(element) {
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>
Below are all options that you can provide your own implementation of.
-
getMetaData(element)
should return the initial meta data to use for the grid; it should return aDataGridViewMetaData
object -
getFooterPlugins(element)
should return the plugin functions to use for building the footer; see footer plugins for more information -
allowColumnResize(element)
should return true for resizable columns in your grid -
allowColumnMove(element)
should return true for grids that allow their columns to be switched around -
allowSelect(element)
should return true for grids that allow a user to select rows -
isMultiselect(element)
should return true for multiple selection; this only works ifallowSelect
returns true for a grid -
hasMultiselectCheckboxes(element)
should return true if multiselect should display checkboxes in the rows; this only works if isMultiselect returns true for a grid -
getContentContainerAttributes()
should return an object with html attributes to apply to the content containers of grids -
getHeaderAttributes()
should return an object with html attributes to apply to the header row of grids -
getSortToggleAttributes()
should return an object with html attributes to apply to the sort toggle in the sorted column in grids -
getHeaderCellAttributes()
should return an object with html attributes to apply to the header cells of grids -
getHeaderDragAttributes()
should return an object with html attributes to apply to the header drag handles in the header cells of grids -
getHeaderMoveIndicatorAttributes()
should return an object with html attributes to apply to the arrow indicator that shows when moving a header -
getHeaderMoveTitleAttributes()
should return an object with html attributes to apply to the title element that shows when moving a header -
getBodyAttributes()
should return an object with html attributes to apply to the container of data rows of grids -
getRowAttributes()
should return an object with html attributes to apply to the data rows of grids -
getCellAttributes()
should return an object with html attributes to apply to the data cells of grids -
getTotalRowAttributes()
should return an object with html attributes to apply to the total rows of grids -
getTotalCellAttributes()
should return an object with html attributes to apply to the total cells of grids -
getFooterAttributes()
should return an object with html attributes to apply to the footer container of grids -
getFooterElementAttributes()
should return an object with html attributes to apply to the individual footer elements of grids -
getStyleAttributes()
should return an object with html attributes to apply to the style elements that grids use for column width and visibility