Drag row in datatable without reorder other rows

Hello friends of webix.

I have had a look for any topic but couldn’t find one. My question is.

Can I drag a row to another place inside the datatable and keep the old place empty so that other would not be reordered?

Thank you

Hello @Michael,

Unfortunately, this functionality is not provided by the Webix package. However, we can offer you to customize the behavior of DnD through several events. Please, check out the snippet with the example: Code Snippet.

The essence of customization is to simulate an empty space after dragging a line in the place where the line was removed. This can be done by saving the index of the old item inside the onBeforeDrop() event. And then, in the onAfterDrop() event, in the place where the line was removed, we create a new empty line. To prevent the server from receiving an extra update when adding an empty line, we add ignore() method to dp (more info about DataProcessing you find here).

To interact with empty rows and add cofigurate specificly them, when we initialize a new empty row, we can give it a unique property, $empty: true, for example. Thus, through the events onBeforeDrag(), onBeforeEditStart(), onBeforeSelect() you can disable editing, selecting and dragging for rows that have a specific property ($empty: true). To ignore empty lines when exporting, you can add a filter for lines with the $empty: true property. Serialization can be bypassed via $scheme with the same property.

Please note, that work with data filtering and sorting can require additional conditions.