I have the following code that displays grid in this way grid
Ext.onReady(function() {
var ct = Ext.create('Ext.container.Viewport', {
layout: 'border',
defaults: {
collapsible: true,
split: true
},
items: [{
collapsible: false,
autoScroll: true,
region: 'center',
margins: '5 0 0 0',
items: [{
xtype: 'grid',
id: 'MyGridPanel',
title: 'Test Grid',
flex: 3,
forceFit: true,
overflowY: 'scroll',
store: {
fields: ['name', 'permissions'],
proxy: {
type: 'memory',
reader: {type: 'json'}
},
data: [{
name: 'Farms',
permissions:{
'manage': 1,
'clone': 1,
'launch': 0,
'terminate': 0,
'not-owned-farms': 0
}
},{
name: 'Alerts',
permissions:null
},{
name: 'Servers',
permissions:null
},{
name: 'Events and notifications',
permissions:null
},{
name: 'Statistics',
permissions:null
},{
name: 'Roles',
permissions:{
'manage':1,
'clone':0,
'bundletasks':0
}
},{
name: 'Scripts',
permissions:{
'manage':0,
'execute':0,
'fork':0
}
}]
},
columns: [{
text: 'Name',
dataIndex: 'name'
},{
text: 'Permissions',
dataIndex: 'permissions',
width: 200,
renderer: function (value, metaData, record, rowIndex, colIndex, store, view) {
var checkboxes = '';
for (var variable in value) {
var temp = value[variable] === 1 ? 'checked' : '';
checkboxes += '<input type="checkbox" ' + 'name="' + variable + '" value="' +
value[variable] + '"' + temp + '>' + variable;
}
return checkboxes;
}
}]
}]
}]
});
I would like to save each checkbox value, so when I change the checked value of checkbox it saves even after page reload. I am trying to use listeners, or maybe the simpliest way exists. Or maybe some stateful or stateevents.
Thanks for help!
Aucun commentaire:
Enregistrer un commentaire