Drag a row into another row possible?

Drag a row into another row possible?

FrknFrkn Posts: 8Questions: 3Answers: 0

Is it possible to modify the rowreorder plugin so that it's possible to drag a row into another row? I would like to build a function to merge 2 rows together.

The rowreorder extension seems to be the closest match to my desired function, but i will probably have to modify it to snap on other rows instead of the space between.

Any idea where to start with this?

Replies

  • kthorngrenkthorngren Posts: 21,911Questions: 26Answers: 5,062
    edited April 14

    It might be possible using the row-reorder event. You can get the information about the reordered rows. Merge the row data then cancel Datatables reordering of the rows by returning false.

    You might be better off using the HTML drag and drop than to try fitting the RowReorder extension into this behavior. I created some examples in this thread.

    Kevin

  • allanallan Posts: 64,299Questions: 1Answers: 10,618 Site admin

    RowReorder is designed to insert between rows, so you'd need to do a fair amount of overhauling the code to have it insert on top of another row instead. It would be possible and the RowReorder code might be a good starting point if you are interested - this is where to start - that's where the insert check is done.

    I'd agree with Kevin - try using HTML drag and drop instead (I'm trying to recall if I've used it on table rows before, and failing to do so - sorry! There might be issues with it moving table rows around, I'm not sure).

    Allan

Sign In or Register to comment.