curious1
curious1

Reputation: 14717

JqGrid: drop event does NOT get fired when draging and dropping a row in the SAME grid

I am hoping to catch the drop event when dragging and droping a row in the same grid.

I am looking the "Sortable Rows" example listed here (version 3.6)

http://trirand.com/blog/jqgrid/jqgrid.html

I am able to replicate this example locally. Instead of using

jQuery("#sortrows").jqGrid('sortableRows');

from the example, I used the following:

jQuery("#sortrows").jqGrid('sortableRows', {
   ondrop: function (ev, ui, getdata) {
     alert('fired');
   }    
});

I did not change anything else. However, the ondrop event seems not fired when I drop a row.

How to catch drop and other events in my situation?

BTW, what is the normal strategy of refreshing the table after drag/drop, if I have a grid with rows of alternating colors?

Thanks and regards!

Upvotes: 0

Views: 774

Answers (1)

curious1
curious1

Reputation: 14717

I found this post:

Using SortableRows and know when rows have been moved

which mentions:

jQuery("#grid").sortableRows( options )

"options" is the passed to the sortable plugin.

options = { update : function(e,ui){} }

In the update method, I used the following:

$(grid_selector).trigger("reloadGrid");

Hope this helps. Love to hear better solutions.

Upvotes: 1

Related Questions