2012-01-27 4 views
2

У меня есть сетка с моделью выбора флажка. Я хочу предварительно установить флажки на основе хранилища данных для сетки. Кто-нибудь может помочь мне?pre check checkbox в checkboxselection model + extjs

ответ

0

Строки можно выбрать, используя событие «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); 
    }) 
});