How do you do reordering of grid rows in ExtJs 4 by drag and drop? And is it possible? I see there is an example for drag and drop grid rows between 2 grids in the ExtJs examples page, but I don't seem to be able to figure out how to use this and make it work in one grid only.
I'll appreciate your help.
Thanks.
OK, so I just figured it out. It was quite simple actually... All I needed was to simply add
plugins: {
ptype: 'gridviewdragdrop'
}
to the grid's viewConfig and it works just fine.
Please don't down-rate this question. I'm sorry I didn't search more for the answer before posting the question here and had to answer my own question, but hope the answer will help someone else if searching for a solution to the same problem.
plugins: {
ptype: 'gridviewdragdrop',dragText:'Reorder Rows'
},
// to save position
listeners:{
drop:function(){
Ext.Ajax.request({
url:'url-to-save-position',
params:{
value:Ext.encode(Ext.pluck(grid.getStore().data.items, 'data'))
}
})
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With