Ext.js CheckboxModel 取消选中数据 - 实现撤销功能
{"selModel": {"mode": "simple", "selType": "checkboxmodel"}} 添加后不能撤销选中的数据内容:要实现撤销选中的数据,可以使用 Ext.selection.CheckboxModel
的 deselectAll
方法。具体做法是在选择模型中添加一个 listeners
配置项,在 selectionchange
事件触发时调用 deselectAll
方法撤销选中的数据。以下是一个示例代码:\n\njavascript\nselModel: {\n mode: "simple",\n selType: "checkboxmodel",\n listeners: {\n selectionchange: function(selectionModel, selectedRecords) {\n if (selectedRecords.length === 0) {\n selectionModel.deselectAll();\n }\n }\n }\n}\n
\n\n在上面的代码中,当选中的记录数为0时(即没有选中任何数据),调用 deselectAll
方法撤销选中的数据。\n\n希望这个解决方案对您有帮助!
原文地址: http://www.cveoy.top/t/topic/pG9S 著作权归作者所有。请勿转载和采集!