mirror of https://gitee.com/karson/fastadmin.git
新增自定义编辑删除按钮
parent
9b2ec96a03
commit
b6f2307737
|
|
@ -8772,6 +8772,7 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
|
|||
|
||||
return $[NS] = Validator;
|
||||
}));
|
||||
|
||||
/*********************************
|
||||
* Themes, rules, and i18n support
|
||||
* Locale: Chinese; 中文
|
||||
|
|
@ -9980,6 +9981,29 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
|
|||
destroyallbtn: '.btn-destroyall',
|
||||
dragsortfield: 'weigh',
|
||||
},
|
||||
button: {
|
||||
edit: {
|
||||
name: 'edit',
|
||||
icon: 'fa fa-pencil',
|
||||
title: __('Edit'),
|
||||
extend: 'data-toggle="tooltip"',
|
||||
classname: 'btn btn-xs btn-success btn-editone'
|
||||
},
|
||||
del: {
|
||||
name: 'del',
|
||||
icon: 'fa fa-trash',
|
||||
title: __('Del'),
|
||||
extend: 'data-toggle="tooltip"',
|
||||
classname: 'btn btn-xs btn-danger btn-delone'
|
||||
},
|
||||
dragsort: {
|
||||
name: 'dragsort',
|
||||
icon: 'fa fa-arrows',
|
||||
title: __('Drag to sort'),
|
||||
extend: 'data-toggle="tooltip"',
|
||||
classname: 'btn btn-xs btn-primary btn-dragsort'
|
||||
}
|
||||
},
|
||||
api: {
|
||||
init: function (defaults, columnDefaults, locales) {
|
||||
defaults = defaults ? defaults : {};
|
||||
|
|
@ -10030,6 +10054,12 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
|
|||
}
|
||||
Toastr.error(__('Unknown data format'));
|
||||
});
|
||||
//当加载数据成功时
|
||||
table.on('load-success.bs.table', function (e, data) {
|
||||
if (typeof data.rows === 'undefined' && typeof data.code != 'undefined') {
|
||||
Toastr.error(data.msg);
|
||||
}
|
||||
});
|
||||
//当刷新表格时
|
||||
table.on('refresh.bs.table', function (e, settings, data) {
|
||||
$(Table.config.refreshbtn, toolbar).find(".fa").addClass("fa-spin");
|
||||
|
|
@ -10481,32 +10511,14 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
|
|||
names.push(item.name);
|
||||
});
|
||||
if (options.extend.dragsort_url !== '' && names.indexOf('dragsort') === -1) {
|
||||
buttons.push({
|
||||
name: 'dragsort',
|
||||
icon: 'fa fa-arrows',
|
||||
title: __('Drag to sort'),
|
||||
extend: 'data-toggle="tooltip"',
|
||||
classname: 'btn btn-xs btn-primary btn-dragsort'
|
||||
});
|
||||
buttons.push(Table.button.dragsort);
|
||||
}
|
||||
if (options.extend.edit_url !== '' && names.indexOf('edit') === -1) {
|
||||
buttons.push({
|
||||
name: 'edit',
|
||||
icon: 'fa fa-pencil',
|
||||
title: __('Edit'),
|
||||
extend: 'data-toggle="tooltip"',
|
||||
classname: 'btn btn-xs btn-success btn-editone',
|
||||
url: options.extend.edit_url
|
||||
});
|
||||
Table.button.edit.url = options.extend.edit_url;
|
||||
buttons.push(Table.button.edit);
|
||||
}
|
||||
if (options.extend.del_url !== '' && names.indexOf('del') === -1) {
|
||||
buttons.push({
|
||||
name: 'del',
|
||||
icon: 'fa fa-trash',
|
||||
title: __('Del'),
|
||||
extend: 'data-toggle="tooltip"',
|
||||
classname: 'btn btn-xs btn-danger btn-delone'
|
||||
});
|
||||
buttons.push(Table.button.del);
|
||||
}
|
||||
return Table.api.buttonlink(this, buttons, value, row, index, 'operate');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,6 +72,29 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
|
|||
destroyallbtn: '.btn-destroyall',
|
||||
dragsortfield: 'weigh',
|
||||
},
|
||||
button: {
|
||||
edit: {
|
||||
name: 'edit',
|
||||
icon: 'fa fa-pencil',
|
||||
title: __('Edit'),
|
||||
extend: 'data-toggle="tooltip"',
|
||||
classname: 'btn btn-xs btn-success btn-editone'
|
||||
},
|
||||
del: {
|
||||
name: 'del',
|
||||
icon: 'fa fa-trash',
|
||||
title: __('Del'),
|
||||
extend: 'data-toggle="tooltip"',
|
||||
classname: 'btn btn-xs btn-danger btn-delone'
|
||||
},
|
||||
dragsort: {
|
||||
name: 'dragsort',
|
||||
icon: 'fa fa-arrows',
|
||||
title: __('Drag to sort'),
|
||||
extend: 'data-toggle="tooltip"',
|
||||
classname: 'btn btn-xs btn-primary btn-dragsort'
|
||||
}
|
||||
},
|
||||
api: {
|
||||
init: function (defaults, columnDefaults, locales) {
|
||||
defaults = defaults ? defaults : {};
|
||||
|
|
@ -122,6 +145,12 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
|
|||
}
|
||||
Toastr.error(__('Unknown data format'));
|
||||
});
|
||||
//当加载数据成功时
|
||||
table.on('load-success.bs.table', function (e, data) {
|
||||
if (typeof data.rows === 'undefined' && typeof data.code != 'undefined') {
|
||||
Toastr.error(data.msg);
|
||||
}
|
||||
});
|
||||
//当刷新表格时
|
||||
table.on('refresh.bs.table', function (e, settings, data) {
|
||||
$(Table.config.refreshbtn, toolbar).find(".fa").addClass("fa-spin");
|
||||
|
|
@ -573,32 +602,14 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
|
|||
names.push(item.name);
|
||||
});
|
||||
if (options.extend.dragsort_url !== '' && names.indexOf('dragsort') === -1) {
|
||||
buttons.push({
|
||||
name: 'dragsort',
|
||||
icon: 'fa fa-arrows',
|
||||
title: __('Drag to sort'),
|
||||
extend: 'data-toggle="tooltip"',
|
||||
classname: 'btn btn-xs btn-primary btn-dragsort'
|
||||
});
|
||||
buttons.push(Table.button.dragsort);
|
||||
}
|
||||
if (options.extend.edit_url !== '' && names.indexOf('edit') === -1) {
|
||||
buttons.push({
|
||||
name: 'edit',
|
||||
icon: 'fa fa-pencil',
|
||||
title: __('Edit'),
|
||||
extend: 'data-toggle="tooltip"',
|
||||
classname: 'btn btn-xs btn-success btn-editone',
|
||||
url: options.extend.edit_url
|
||||
});
|
||||
Table.button.edit.url = options.extend.edit_url;
|
||||
buttons.push(Table.button.edit);
|
||||
}
|
||||
if (options.extend.del_url !== '' && names.indexOf('del') === -1) {
|
||||
buttons.push({
|
||||
name: 'del',
|
||||
icon: 'fa fa-trash',
|
||||
title: __('Del'),
|
||||
extend: 'data-toggle="tooltip"',
|
||||
classname: 'btn btn-xs btn-danger btn-delone'
|
||||
});
|
||||
buttons.push(Table.button.del);
|
||||
}
|
||||
return Table.api.buttonlink(this, buttons, value, row, index, 'operate');
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue