PDA

View Full Version : Editor Grig listners



bozzoz
4 Aug 2010, 2:49 AM
Hello I have added the listners to my editor grid in this way:



winElencoGdl = Ext.extend(winElencoGdlUi, {
initComponent: function() {
winElencoGdl.superclass.initComponent.call(this);

var griglia = this.arMemberGrid;

//carico i dati dallo store
griglia.store.load();

//aggiungo un listner per l'editing on line
griglia.addListener({
afteredit: function(e){
var conn = new Ext.data.Connection();
conn.request({
url: 'ajax/updateElencoGdl.php',
params: {
action: 'update',
id: e.record.id,
campo: e.field,
valore: e.value
},
success: function(response, opt){
if (response.responseText == 'success')
{
griglia.store.load();
}
else
{
console.log(response.responseText);
}
},
failure: function(resp, opt){

console.log(response.responseText);

}
});
}
});
}
});



Is that right?

There is a better way?

Thanks

jarrednicholls
4 Aug 2010, 6:40 AM
That's exactly right, looks good to me! Only thing I'll throw out there is that there is a function "on" that is shorthand for "addListener" just to save a few bytes :-)

bozzoz
4 Aug 2010, 7:31 AM
Thank you Jarred!