I would like to enable the grid to have drag and drop rows, that will allow the grid rows to be ordered very dynamically. Is there away to do this?
Hi,
Currently there is no such feature in igGrid. You can try to instantiate jQuery UI Sortable on the grid tbody element, but then you'll need to implement some custom logic in order to save the new row index in the grid.
Hope this helps,Martin PavlovInfragistics, Inc.
I tried doing that but it does not work. I added these two lines in the jquery window ready function. Even tried putting it in the $.ig.loader function, but that does not work as well. Please assist. We have a need for this functionality and any help will be appreciated. Please respond to me at biren.ajmera@kochind.com as I'm not sure what email address this account is setup with.
$("#igGrid tbody").sortable(); $("#igGrid tbody").disableSelection();
Hello Kstitdeveloper,
Attached you can find a working sample demonstrating rows drag and drop.
Best regards,Martin PavlovInfragistics, Inc.
Based on your recommendation I have tried to implement the drag and drop of rows.
Primarly everything works fine. I have been also able to update the table cells to reflect the new sorting order.
But I have found a problem, which happens after applying a updateRow command. The other table cells were refreshed with the old content.
As far as I have understand this happens because the underlying datasource must be also updated.
The question is how can I achieve this?
Well, I have found solution. May be it will be helpfull for someone else:
We just need to recalculate height:
start: function (evt, ui) {
ui.placeholder.height(ui.item.height());
...
Hello,
I have tried your solution and it works fine :)
But I noticed one issue. It works weird when we are switching-on Selection feature and when we are trying to drag selected row. Do you have any ideas about the reason?
Thanks,
Aliaksei
I can access the record by findRecordByKey and apply the same changes like sorting order to the datasource items, but unfortunately I can't sort this datasource array.