Предварительный выбор флажков в checkboxselection model + extjs - PullRequest
2 голосов
/ 27 января 2012

У меня есть сетка с флажком выбора модели. Я хочу предварительно выбрать флажки на основе хранилища данных для сетки. Может кто-нибудь помочь мне?

1 Ответ

0 голосов
/ 07 мая 2012

Строки могут быть выбраны с помощью события «load» хранилища и метода «selectRows» объекта RowSelectionModel.

var grid = new Ext.grid.GridPanel(...
           sm:new Ext.grid.RowSelectionModel(),..); 
var store = new Ext.data.JsonStore(...);
store.on('load',function(records){
     Ext.each(records,function(record){
          //here you construct an array of row numbers in the grid that you want         to select, based on the records you just loaded into the store , let the array be 'rows'
       grid.getSelectionModel.selectRows(rows); 
     }) 
});
...