ultramedia
15 Oct 2009, 8:21 PM
Hey everyone,
I'm doing a thing at the moment where I would prefer to add properties to a property grid after creation (long story). I found an excellent thread for doing it in Ext 2 (thanks to condor) but had to tweak it (slightly) to get it going in Ext 3.
Turns out it just needed propStore to be removed from Condors original script to be Ext 3 friendly. Seems to be working fine now so I thought I'd share in case it was useful to anyone else...
Ext.override(Ext.grid.PropertyGrid, {
setProperty: function(property, value){
this.source[property] = value;
var r = this.store.getById(property);
if(r){
// update property
r.set('value', value);
}else{
// add property
this.store.add(new Ext.grid.PropertyRecord({name: property, value: value}, property));
}
},
removeProperty: function(property){
delete this.source[property];
var r = this.store.getById(property);
if(r){
// remove property
this.store.remove(r);
}
}
});(apologies if this has already been done, I looked but I couldn't find it anywhere)
I'm doing a thing at the moment where I would prefer to add properties to a property grid after creation (long story). I found an excellent thread for doing it in Ext 2 (thanks to condor) but had to tweak it (slightly) to get it going in Ext 3.
Turns out it just needed propStore to be removed from Condors original script to be Ext 3 friendly. Seems to be working fine now so I thought I'd share in case it was useful to anyone else...
Ext.override(Ext.grid.PropertyGrid, {
setProperty: function(property, value){
this.source[property] = value;
var r = this.store.getById(property);
if(r){
// update property
r.set('value', value);
}else{
// add property
this.store.add(new Ext.grid.PropertyRecord({name: property, value: value}, property));
}
},
removeProperty: function(property){
delete this.source[property];
var r = this.store.getById(property);
if(r){
// remove property
this.store.remove(r);
}
}
});(apologies if this has already been done, I looked but I couldn't find it anywhere)