需求:如图示例,要根据每行条件来显示是否显示操作按钮。
解决方案:在对应的js文件中,加入:
formatter: function(value, row, index) { var that = $.extend({}, this); var table = $(that.table).clone(true); if (row.status !== 0) { // 若status不等于0,则不显示编辑按钮, // 【operate-edit】对应编辑按钮, // 【operate-add】对应添加按钮, // 【operate-del】对应删除按钮, $(table).data("operate-edit", null); } that.table = table; return Table.api.formatter.operate.call(that, value, row, index); }