浏览代码

data-formatter is not working with data-checkbox

http://stackoverflow.com/questions/32246157/format-column-with-checkboxes-in-bootstrap-table
jorrigala 10 年之前
父节点
当前提交
c5dc6c39de
共有 1 个文件被更改,包括 14 次插入13 次删除
  1. 14 13
      dist/bootstrap-table.js

+ 14 - 13
dist/bootstrap-table.js

@@ -1470,19 +1470,20 @@
                     type = column.radio ? 'radio' : type;
                     type = column.radio ? 'radio' : type;
 
 
                     text = [that.options.cardView ?
                     text = [that.options.cardView ?
-                        '<div class="card-view">' : '<td class="bs-checkbox">',
-                        '<input' +
-                        sprintf(' data-index="%s"', i) +
-                        sprintf(' name="%s"', that.options.selectItemName) +
-                        sprintf(' type="%s"', type) +
-                        sprintf(' value="%s"', item[that.options.idField]) +
-                        sprintf(' checked="%s"', value === true ||
-                            (value && value.checked) ? 'checked' : undefined) +
-                        sprintf(' disabled="%s"', !column.checkboxEnabled ||
-                            (value && value.disabled) ? 'disabled' : undefined) +
-                        ' />',
-                        that.options.cardView ? '</div>' : '</td>'
-                    ].join('');
+							'<div class="card-view">' : '<td class="bs-checkbox">',
+							'<input' +
+							sprintf(' data-index="%s"', i) +
+							sprintf(' name="%s"', that.options.selectItemName) +
+							sprintf(' type="%s"', type) +
+							sprintf(' value="%s"', item[that.options.idField]),
+							column.formatter === undefined ?
+							sprintf(' checked="%s"', value === true ||
+								(value && value.checked) ? 'checked' : undefined) +
+							sprintf(' disabled="%s"', !column.checkboxEnabled ||
+								(value && value.disabled) ? 'disabled' : undefined) +
+							' />': ' />' + value,
+							that.options.cardView ? '</div>' : '</td>'
+						].join('');
 
 
                     item[that.header.stateField] = value === true || (value && value.checked);
                     item[that.header.stateField] = value === true || (value && value.checked);
                 } else {
                 } else {