View Full Version : How do I add edit and delete function for each row in grid

22 Dec 2006, 9:53 PM
I want to add edit and delete function in my JSON grid. I had read some thread tell about that but it only give me how to add delete function and not have some code. Please help me in more detail and give me some code to solve this problem.

23 Dec 2006, 9:56 AM
I would suggest you spend some more time reading threads and jack's blog. There are numerous discussion/examples of grid functionality. Read the blog entries regarding grids - one of them links to the sample yui-ext implementation of this forum (http://jackslocum.com/forum2/) which has a grid that does adds.

13 Mar 2011, 8:30 PM
This is what i have done.

I have added a RowSelectionModel object to the grid, and then in the handler deleted the selected row.

var jsonGrid = new Ext.grid.EditorGridPanel({
store: jsonStore,
cm: cm,
sm: new Ext.grid.RowSelectionModel({singleSelect:true}),
renderTo: 'user-grid',
//width: 470,
height: 330,
// view : gridView,
// autoExpandColumn: 'title', // column with this id will be expanded
// title: 'Json Grid',
frame: true,
clicksToEdit: 1,
/*buttons:[new Ext.Button({
text: 'Submit',
handler: function(){
tbar: [{
text: 'Add Mandate',
iconCls: 'silk-add',
handler : function(){
// access the Record constructor through the grid's store
var Mandate = jsonGrid.getStore().recordType;
var p = new Mandate({
type: 'Select',
serviceOwner: 'All',
serviceName: 'All',
transactType: 'Select',
jsonStore.insert(0, p);
jsonGrid.startEditing(0, 0);
text: 'Delete Mandate',
iconCls: 'silk-delete',
handler : function(sm, rowIdx,r){
var rec = jsonGrid.getSelectionModel().getSelected();
if (!rec) {
return false;