PDA

View Full Version : Store does not throw remove event automatically



Shwin
31 Aug 2010, 8:43 AM
Hi Everyone

I have just started using Ext JS so I'm pretty new to things like handlers and listeners. I have a button on my EditorGrid to remove multiple rows from grid. The problem is that with the code below, it actually removes those rows from the grid but it does not fire the remove event unless I trigger it with store.fireEvent() . when I use
store.fireEvent('remove',this,s); I get an array like [ext-record-5,ext-record-3] . I tried various things but could not find a way to get the field out of these records and send it to backend sql database. If I put the fireevent inside the loop like store.fireEvent('remove',this,r.get('timecardno')); I get strange error messages coming from ext-all.js .




text:'Remove Something',
tooltip:'Remove the selected item',
iconCls:'remove',
// Place a reference in the GridPanel
ref: '../removeButton',
disabled: true,
handler: function() {
grid4.stopEditing();
var s = grid4.getSelectionModel().getSelections();
for(var i = 0, r; r = s[i]; i++){
store.remove(r);
//store.fireEvent('remove',this,r.get('timecardno'));
}
store.fireEvent('remove',this,s);

}