In Ext.grid.Panel when user changes checkbox's state, I need to save the model that represents this row.
I have this code (very simplistically, because this component is very big):
Ext.define('Hts.Appointments.List.Grid', {
extend : 'Ext.grid.Panel',
initComponent : function() {
this.store = /* Big initialization code for store */
this.columns = [{
header: Hts.Localization.APPOINTMENTS.HIGHLIGHT,
dataIndex: 'highlighted',
xtype: 'checkcolumn',
flex: 1,
listeners: {
checkchange: function(column,rowIndex,checked) {
/* Here I need to access the model and save it */
}
},
/* other columns */
]
}
})
I hope I provided enough information (I'm very new in ExtJs).
define your model with an id, using property 'idProperty'.
Ext.define('Model', {
extend: 'Ext.data.Model',
idProperty: 'idProp',
fields: [
{ name: 'id', type: 'int' },
{ name: 'name', type: 'string' }
]
});
you can get the model and save it with:
listeners: {
checkchange: function(column,rowIndex,checked) {
var model = Ext.ModelManager.getModel('idProp'); // access
model.save(); //save
}
},
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.