View Full Version : ptype:gridviewdragdrop, submit records in new order

21 Jul 2014, 6:35 AM
I'm using dragdrop plugin. If I rearrange the records then submit them, they still get submitted in the order they were in when store was loaded, and not the new reorganized order.

I checked the docs for gridviewdragdrop but I dont see a config or method() that will allow me to preserve the new order on submit.

Im using checkboxmodel on my grid and to pass records I simply use getSelection() then push the selected records in to an array inside the Ext.each method. Then I pass the array as a param.


29 Jul 2014, 10:01 AM
What do you mean "submit them"?

29 Jul 2014, 11:59 PM

I had the same problem. I solved it by doing this:
- add a 'sortOrder' property to the model
- add a 'updateSortNo' function to the grids store

updateSortNo: function(){
this.each(function(record, index){
var orgNo = record.get('sortOrder');
if (orgNo != (index+1)){
- catching the 'drop' event on the grid

onDrop: function(node,data,overModel,dropPosition,eOpts){
this.getStore().updateSortNo(); //"this" refers to the grid
this.getStore().sort(); // the sorter is sorting on sortOrder

There might be better solutions, but this works for me.