Forum


I am just converting to ver 3.7 and want to use ui.sortable instead of tableDnD; what I cannot figure out is how to send the change to the server when a row has been dropped. What i have from the jQuery site (and the jGrid examples) is the following:
gridComplete : function () {
$("#tbloperatorgroups").jqGrid('sortableRows');
}
....
$( "#tbloperatorgroups" ).bind( "sortupdate", function(event, ui) {
var posturl = updating url ending with: &PK='+row.id;
var neworder = $.sortable.serialize();
$.post( posturl, neworder, function(message,status) {
if(status != 'success') {
alert(message);
}
})
}
) ;
This code snippet has been copied from the tableDnD approach and may no longer be the way to do things. The error I get is that "row" (in the posturl) is unknown.
How do I include the ID of the moved row -- or do I not need to anymore? The documentation isn't very helpful on this.
Thanks
Reg
16:56

Moderators
30/10/2007

Hello Reg,
The way that you use this is not correct. The sortable rows method should not be called in grid Complete event, but after the creation of the grid.
Go into the demo
New in version 3.6 => Sortable Row example
There is a code which will give you a idea.
Also you can set the update event in the same method
jQuery("#sortrows").jqGrid('sortableRows', {
update: function (event, ui) {
....
}
});
Hope this helps
Best Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Hi Tony,
Thanks for the re-direction. I have made the change to how I create the grid and the related calls, but am still missing something in my understanding. My code now looks like this:
$("#tbloperatorgroups").jqGrid('sortableRows', {
update: function(event, ui) {
var posturl = 'wc.dll?PSProcess~AjaxReseq~&Data=OperatorGroups&sk=2YZ0HTYFD06840&sh=104';
var neworder = $("#tbloperatorgroups").sortable("serialize");
$.post( posturl, neworder, function(message,status) {
if(status != 'success') {
alert(message);
}
})
}
})
but neworder contains &undefined = undefined
If I try to put an underscore in the name of the id attribute, the way the jQuery docs suggest, I get the same error.
var neworder = $("#tbloperatorgroups").sortable("serialize",[id='row_id']);
So I am still doing something wrong.
I still need some help, please.
Thanks
Reg
11:41

Moderators
30/10/2007

Hello Reg,
Instead of serialize I recommend you to use getDataIDs method to obtain the ids of the grid and post them to the server.
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Hello Tony,
Thanks for the tip.
I now have the following:
update: function(event, ui) {
var posturl = 'wc.dll?PSProcess~AjaxReseq~&Data=OperatorGroups&sk=2Z50G0BMF14352&sh=24';
var neworder = $("#tbloperatorgroups").jqGrid("getDataIDs");
$.post( posturl, neworder, function(message,status) {
if(status != 'success') {
alert(message);
}
})
}
})
and the grid visually sorts and posts to the server, but neworder contains an array of $undefined=undefined (one for each row inthe grid)
If I change the "var neworder" line to
I get the same result.
When I create the data, I include a < row id > element
What am I doing wrong?
Thanks,
Reg
Most Users Ever Online: 715
Currently Online:
34 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66