mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-01 15:32:48 +08:00
feat: 表格增加行选择的禁用状态设置回调函数,可以动态设置当前行是否可选
This commit is contained in:
@@ -307,6 +307,7 @@
|
||||
options.limit = options.limit || 15;
|
||||
options.limits = options.limits || [10, 15, 20, 25, 50, 100];
|
||||
options.cols = options.cols || [];
|
||||
options.rowDisableCallback = options.rowDisableCallback || null;
|
||||
|
||||
var defaultToolbar = ['filter', 'print'];
|
||||
if (options.layout === true) {
|
||||
@@ -443,6 +444,16 @@
|
||||
|
||||
// 初始化已经选择的值
|
||||
if (selectMode == 'checkbox' || selectMode == 'radio') {
|
||||
if(typeof options.rowDisableCallback == 'function') {
|
||||
for (let index = 0; index < res.data.length; index++) {
|
||||
const dataItem = res.data[index];
|
||||
|
||||
var rowDisableResult = options.rowDisableCallback(dataItem);
|
||||
if(rowDisableResult === false || rowDisableResult === true) {
|
||||
res.data[index].LAY_DISABLED = rowDisableResult;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var selectedIds = admin.getQueryVariable('selectedIds', '');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user