PDA

View Full Version : How to send updated PropertyGrid feilds



cvespa
23 Jan 2014, 8:13 AM
I am taking a propertygrid and filling it with data from a clicked grid row, i would like to be able to update this data in the property grid and have it send back to the store.

Can anyone help me do this?

Here is my property grid when its first created (its just the basic example the docs use (for now)).


Ext.create('Ext.grid.PropertyGrid', {
title: 'Property Grid',
closable: true,
source: {
"(name)": "Properties Grid",
"grouping": false,
"autoFitColumns": true,
"productionQuality": false,
"created": Ext.Date.parse('10/15/2006', 'm/d/Y'),
"tested": false,
"version": 0.01,
"borderWidth": 1
}
})


Here is the code i use to set my click row to the property grid.


itemclick: function(itself, record, item, index, e, e0pts){
var eastpanel = Ext.getCmp('east-panel');
var grid = eastpanel.down('propertygrid');
grid.setSource({
gridId: record.data.id,
gridName: record.data.name,
gridWidth: record.data.width,
gridHeight: record.data.height,
gridDepth: record.data.depth
}, {
gridId: {
displayName: 'Id'
},
gridName: {
displayName: 'Name'
},
gridWidth: {
displayName: 'Width'
},
gridHeight: {
displayName: 'Height'
},
gridDepth: {
displayName: 'Depth'
}
});
}

tobiu
23 Jan 2014, 8:21 AM
did you try this one?
http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.grid.property.Grid-method-getSource

cvespa
23 Jan 2014, 8:55 AM
yes i have looked in to that but how would i manually update the row i changed in the store.

cvespa
24 Jan 2014, 8:08 AM
So i have figured it out but it might not be the best way of doing it, but it works how i want it to.
Ext.create('Ext.grid.PropertyGrid', { title: 'Editing Grid', id: 'propertygrid', closable: false, listeners: { propertychange: function(source, recordId, value, oldValue, eOpts){ var girds = Ext.getCmp('grids'); if(source.Id != null) { var wpgStore = grids.getStore('gridStore'); if(wpgStore.findRecord('id', source.Id) == null) { console.log('The Grid with the id of ' + source.fId + ' does not exist'); } var record = wpgStore.findRecord('id', source.Id); record.set({ id: source.Id, name: source.Name, width: source.Width, height: source.Height, depth: source.Depth }); } } } })]