column-options.md 4.4 KB

Column options


The column options is defined in jQuery.fn.bootstrapTable.columnDefaults.

Name Attribute Type Default Description
radio data-radio Boolean false True to show a radio. The radio column has fixed width.
checkbox data-checkbox Boolean false True to show a checkbox. The checkbox column has fixed width.
field data-field String undefined The column field name.
title data-title String undefined The column title text.
class class / data-class String undefined The column class name.
align data-align String undefined Indicate how to align the column data. "left', 'right', 'center' can be used.
halign data-halign String undefined Indicate how to align the table header. 'left', 'right', 'center' can be used.
valign data-valign String undefined Indicate how to align the cell data. 'top', 'middle', 'bottom' can be used.
width data-width Number undefined The width of column. If not defined, the width will auto expand to fit its contents.
sortable data-sortable Boolean false True to allow the column can be sorted.
order data-order String 'asc' The default sort order, can only be 'asc' or 'desc'.
visible data-visible Boolean true False to hide the columns item.
switchable data-switchable Boolean true False to disable the switchable of columns item.
clickToSelect data-click-to-select Boolean true True to select checkbox or radiobox when the column is clicked.
formatter data-formatter Function undefined The cell formatter function, take three parameters:
value: the field value.
row: the row record data.
index: the row index.
events data-events Object undefined The cell events listener when you use formatter function, take three parameters:
event: the jQuery event.
value: the field value.
row: the row record data.
index: the row index.
sorter data-sorter Function undefined The custom field sort function that used to do local sorting, take two parameters:
a: the first field value.
b: the second field value.
cellStyle data-cell-style Function undefined The cell style formatter function, take three parameters:
value: the field value.
row: the row record data.
index: the row index.
Support classes or css.