Помогите пожалуйста.
Вот никак понять не могу как после загрузки данных в таблицу
проставить выбранные чекбоксы?
json который из базы приходит:
{ "success" : "true", data : [
{"id" : "5", "acl_name" : "ads", "grant_id" : "0"},
{"id" : "3", "acl_name" : "porno", "grant_id" : "0"},
{"id" : "2", "acl_name" : "social", "grant_id" : "3"},
{"id" : "1", "acl_name" : "white", "grant_id" : "0"}
]}
Соответсвенно если grant_id == 0 то checkbox не активен все остальные
чеккбоксы активны
Model:
Ext.define('AP.model.
grantsModel', {
extend: 'Ext.data.Model',
fields: ['id', 'acl_name', 'grant_id' ]
});
Store:
Ext.define('AP.store.grantsStore', {
extend : 'Ext.data.Store',
model: 'AP.model.grantsModel',
proxy: {
type: 'ajax',
actionMethods: 'POST',
url: 'admin/get_grants',
reader: {
type: 'json',
id: 'acl_id',
root: 'data'
}
},
autoLoad: false
});
Grid Panel:
Ext.define('AP.view.groups.showGrants', {
extend: 'Ext.grid.Panel',
alias: 'widget.grantctl',
requires: [
'Ext.toolbar.Toolbar',
'Ext.selection.CheckboxModel'
],
border: true,
title: 'Grants',
autoScroll: true,
margins: '3 3 3 0',
listeners: {
itemclick: function(view, record, item, e) {
}
},
initComponent: function() {
Ext.apply(this, {
store: 'grantsStore',
selModel: Ext.create('Ext.selection.CheckboxModel', {
listeners: {
select: function(sm, record, index) {
alert(record.get('grant_id'));
},
deselect: function(sm, record, index) {
alert(record.get('id'));
}
}
}),
columns: [{
text: 'Acl name',
dataIndex: 'acl_name',
flex: 1
}],
dockedItems: [{
dock: 'top',
xtype: 'toolbar',
border: false,
items: [{}]
}]
});
this.callParent(arguments);
}
});
Подскажите что я делаю не так ?