PDA

View Full Version : Removing a particular row from a Grid panel in Ext JS and arrange the paging



samarulraj
16 Mar 2014, 2:18 PM
Hi Team,

I have been trying for the two days with deleting a particular row in grid panel.

i just added a delete button for every row in grid. which fires the event of delete

while clicking i could able to delete the row in client side but i am unable to call the API to delete from server side and help me where to make a call to server side with API directFn function.

I use only one directFn function that just calls the list of users table with proper paging.

i need solution for editing and deleting the rows .

My store code



var store = Ext.create('Ext.data.Store', {
model : 'Users',
remoteSort : true,
autoLoad : true,
pageSize: 5, // items per page

sorters : [{
property : 'name',
direction : 'ASC'
}],

proxy : {
type : 'direct',
directFn : 'Users.showAllUsers',
reader: {

root: 'users'


}







}
});



My Button Code for Delete:


{
menuDisabled: true,
sortable: false,
xtype:'actioncolumn',
tdCls:'delete',
text : 'Delete',
width:40,
items: [{
icon: 'ext/resources/themes/images/default/dd/drop-no.gif', // Use a URL in the icon config
//iconCls: 'icon-user',
//tooltip: 'Sell stock',
tooltip: 'Delete',
handler: function(grid, rowIndex, colIndex) {
var rec = grid.getStore().getAt(rowIndex);
//alert("Delete " + rec.get('id'));
//console.log(grid.getStore());
Ext.Msg.show({
title:'Delete Record?',
msg: 'You are deleting a record permanently, this cannot be undone. Proceed?',
buttons: Ext.Msg.YESNO,
icon: Ext.Msg.QUESTION,
fn: function(btn){
if(btn === 'yes') {
store.remove(grid.getStore().getAt(rowIndex));



}
}
});

}
}]
},

48320

samarulraj
29 Mar 2014, 6:21 AM
OMG it is unanswered still ! can you help me out of this issue??

Farish
29 Mar 2014, 1:35 PM
after calling store.remove(), you can call store.sync(); that should send a request to your backend with the information about the record to be deleted.

samarulraj
30 Mar 2014, 1:47 AM
Thanks for the reply

it worked.

By

Sam