GeezerVison is showing github.com — making formatter api like cellStyle · fengwit/bootstrap-table@002c474
File tree
Expand file treeCollapse file tree
Open diff view settings
docs/_i18n/en/documentation
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: docs/_i18n/en/documentation/column-options.md +12-1Lines changed: 12 additions & 1 deletion - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -164,7 +164,18 @@ The column options is defined in `jQuery.fn.bootstrapTable.columnDefaults`. |
164 | 164 | The cell formatter function, take three parameters: <br> |
165 | 165 | value: the field value. <br> |
166 | 166 | row: the row record data.<br> |
167 | | - index: the row index.</td> |
| 167 | + index: the row index.<br> |
| 168 | + field: the row field.<br> |
| 169 | + Example usage:<br> |
| 170 | +<pre> |
| 171 | +function formatter(value, row, index, field) { |
| 172 | + if (value === 'foo') { |
| 173 | + return '<strong>' + value + '</strong>'; |
| 174 | + } |
| 175 | + return value; |
| 176 | +} |
| 177 | +</pre> |
| 178 | + </td> |
168 | 179 | </tr> |
169 | 180 | <tr> |
170 | 181 | <td>footerFormatter</td> |
|
Collapse file
Copy file name to clipboardExpand all lines: src/bootstrap-table.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
|
1736 | 1736 | } |
1737 | 1737 |
|
1738 | 1738 | value = calculateObjectValue(column, |
1739 | | - that.header.formatters[j], [value_, item, i], value_); |
| 1739 | + that.header.formatters[j], [value_, item, i, field], value_); |
1740 | 1740 |
|
1741 | 1741 | if (item['_' + field + '_data'] && !$.isEmptyObject(item['_' + field + '_data'])) { |
1742 | 1742 | $.each(item['_' + field + '_data'], function(k, v) { |
|