我无法为具有Ext.selection.CheckboxModel的网格动态选择多行。
我有要选择的行的索引。发生了什么事情是在选择电话之后。
for(var i=0;i<count;i++){
Ext.getCmp('loadFrameStateInfoTable').getSelectionModel().select(oldStateSelection[i].index);
}
我在网格中选择了但只有一行。这是索引来自oldStateSelection[i].index
的最后一行。
网格应选择所有行。
答案 0 :(得分:3)
正如您在docs中所看到的,如果您不希望取消选择其他行,则需要设置 keepExisting 。
select(oldStateSelection[i].index, true);
答案 1 :(得分:0)
这是 ExtJS 6.2.0 及更高版本的新方法:
.getSelectionModel().select(i,true)
- 为我工作。这里我记录下索引。
方法文档:
<块引用>select ( records, [keepExisting], [suppressEvent] )
按记录实例或索引选择记录实例。
参数
Ext.data.Model[]/Number
记录数组或索引Boolean (optional)
True 保留现有选择;默认为:falseBoolean (optional)
True 不触发选择事件;默认为:false