列参数
列参数定义在 jQuery.fn.bootstrapTable.columnDefaults
。
名称 | 标签 | 类型 | 默认 | 描述 |
---|---|---|---|---|
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. |
titleTooltip | data-title-tooltip | String | undefined | The column title tooltip text. This option also support the title HTML attribute |
class | class / data-class | String | undefined | The column class name. |
rowspan | rowspan / data-rowspan | Number | undefined | Indicate how many rows a cell should take up. |
colspan | colspan / data-colspan | Number | undefined | Indicate how many columns a cell should take up. |
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. |
falign | data-falign | String | undefined | Indicate how to align the table footer. '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 {Pixels or Percentage} | undefined | The width of column. If not defined, the width will auto expand to fit its contents. Also you can add '%' to your number and the bootstrapTable will use the percentage unit, otherwise, you can add or no the 'px' to your number and then the bootstrapTable will use the pixels |
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. |
cardVisible | data-card-visible | Boolean | true | False to hide the columns item in card view state. |
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 context (this) is the column Object. The cell formatter function, take three parameters: value: the field value. row: the row record data. index: the row index. |
footerFormatter | data-footer-formatter | Function | undefined | The context (this) is the column Object. The function, take one parameter: data: Array of all the data rows. the function should return a string with the text to show in the footer cell. |
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. rowA: the first row. rowB: the second row. |
sortName | data-sort-name | String | undefined | Provide a customizable sort-name, not the default sort-name in the header, or the field name of the column. For example, a column might display the value of fieldName of "html" such as "<b><span style="color:red">abc</span></b>", but a fieldName to sort is "content" with the value of "abc". |
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. field: the row field. Support classes or css. |
searchable | data-searchable | Boolean | true | True to search data for this column. |
searchFormatter | data-search-formatter | Boolean | true | True to search use formated data. |
escape | data-escape | Boolean | false | Escapes a string for insertion into HTML, replacing &, <, >, ", `, and ' characters. |
showSelectTitle | data-show-select-title | Boolean | false | True to show the title of column with 'radio' or 'singleSelect' 'checkbox' option. |