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