PDA

View Full Version : Datagrid Multiselect, delete multiple rows



sassouki
16 Aug 2011, 2:50 AM
Hello All,
i have a multiselect RESTFUL datagrid:


var selMod = grid.getSelectionModel();
selMod.setSelectionMode( 'MULTI' );

in the toolbar, i havae a delete button:


xtype: 'button', text: 'Delete', itemId: 'btnDelete', iconCls: 'icon-delete',
handler: function(){
Ext.MessageBox.confirm('Confirm', 'Are you sure you want to delete this record(s)?', function(btn){
if (btn == 'yes'){
var selection = grid.getView().getSelectionModel().getSelection();
if (selection) {
var n=selection.length;
while(n>0){
store.remove(selection[n-1]);
n--;
}
}
}
});
}


The Problem is that it delete only one record!

Chrome developer Tools:
Request URL:http://127.0.0.1/bca/admin/app.php/dalil/27?_dc=1313132972561
Request Method:DELETE
Status Code:200 OK
Request Headersview source
Accept:*/*
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Connection:keep-alive
Content-Length:27
Content-Type:application/json
Cookie:PHPSESSID=622q1sq9fo6o91dl2ir4pkuj87
Host:127.0.0.1
Origin:http://127.0.0.1
Referer:http://127.0.0.1/bca/admin/
User-Agent:Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.107 Safari/535.1
X-Requested-With:XMLHttpRequest
Query String Parametersview URL encoded
_dc:1313132972561
Request Payload
{"id":27,"nom":2,"tel":"2"}
Response Headersview source
Cache-Control:no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection:Keep-Alive
Content-Length:56
Content-Type:text/html
Date:Fri, 12 Aug 2011 07:09:32 GMT
Expires:Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive:timeout=5, max=100
Pragma:no-cache
Server:Apache/2.2.16 (Win32) PHP/5.3.3
X-Powered-By:PHP/5.3.3
AllDocumentsStylesheetsImagesScriptsXHRFontsWebSocketsOther

Thx