8000 Patch 3 - New Feature for Editable extension (#2038) · Robothan/bootstrap-table@3722fdd · GitHub
[go: up one dir, main page]

Skip to content

Commit 3722fdd

Browse files
dreamerworkswenzhixin
authored andcommitted
Patch 3 - New Feature for Editable extension (wenzhixin#2038)
* Add conditional activation of editable by row just define an option called "conditional" with content function(value, row, index). inside that function make the test to decide if the field is to be editable or not, if it is to be editable return "false" else return the html that should be used instead.
1 parent 92b6cb8 commit 3722fdd

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

src/extensions/editable/bootstrap-table-editable.js

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,24 @@
6969
$.each(editableOptions, function (key, value) {
7070
editableDataMarkup.push(' ' + key + '="' + value + '"');
7171
});
72+
73+
var _dont_edit_formatter = false;
74+
if (column.editable.hasOwnProperty('noeditFormatter')) {
75+
_dont_edit_formatter = column.editable.noeditFormatter(value, row, index);
76+
}
77+
78+
if (_dont_edit_formatter === false) {
79+
return ['<a href="javascript:void(0)"',
80+
' data-name="' + column.field + '"',
81+
' data-pk="' + row[that.options.idField] + '"',
82+
' data-value="' + result + '"',
83+
editableDataMarkup.join(''),
84+
'>' + '</a>'
85+
].join('');
86+
} else {
87+
return _dont_edit_formatter;
88+
}
7289

73-
return ['<a href="javascript:void(0)"',
74-
' data-name="' + column.field + '"',
75-
' data-pk="' + row[that.options.idField] + '"',
76-
' data-value="' + result + '"',
77-
editableDataMarkup.join(''),
78-
'>' + '</a>'
79-
].join('');
8090
};
8191
});
8292
};

0 commit comments

Comments
 (0)
0