I am using the tableDnD with jqGrid. AWESOME! So when I click on the row to move the item, it works fine with no issues.
Once you move your row, I make an ajax call on the tableDnD's onDrop handle. So when the data has been updated by the server I want to reload the grid (which works just fine) so that the sort order (which is also a colModel column the user can see) can be refreshed on the screen. This works great too. Bu now this is where I have the issue. How do I edit the record, that is, your jqGrid adds the "selected" class to the row so that when I click on the jqGrid footer's "edit this record" button it knows what record you selected. I tried to keep a reference with a variable to the row that was clicked on, but even though it successfully adds the "selected" class back to the clicked row after the grid has reloaded, I can see this in Firebug, it just adds it temporarily and then something else removes it again after just a split second, I am not sure what is removing it. I don't know if anyone else has this issue, and ideas. See my code example below:
.tableDnD({ onDrop: function(table, row) { $.ajax({ data: $.tableDnD.serialize(), url: $('#ajaxUpdateLookupSortOrderUrl').val() + '/?lookup=' + $('#LookupListWrapper #LookupListSearchWrapper #Lookups').val(), type: "POST", success: function(data, result) { //Reload so that the SortOrder column is refreshed from the DB with the new Sort Order $(item).trigger('reloadGrid'); $(item).find('tr#'+$(row).attr('id')).addClass('selected');//trying to add the class back so that I can click on edit button } }) } }) ;
BTW, 200 miliseconds seems to be the minimum, if I go below this it starts to get unpredictable for larger lists. For example if you have a list of countries 100 is too little. For a list of 10 or so, 50 miliseconds is more than enough, so to be on the safe side and since my list of countries is the biggest I opted for 200ms. Please note that I use the same jqGrid for all my lookups.
I am trying to use jqgrid treeview with table DND plugin to make tree nodes/leafs ( multiple rows) drag and drop between two grids. I tried to use the code shown here. but it is not working for me. I am very new to jquery world. Please let me know if it is possible ? and will appreciate sharing some example code