Table cell ordering

Table cell ordering

jspadminijspadmini Posts: 1Questions: 1Answers: 0

Hi Team,
we are using datatable plugin in our project and we have a requirement to do table cell reordering within table row.
Example : Inside Table row<tr> we have a 2 or more <td> which needs re-ordering functionality

Do you provide some options or suggestions in achieving this

Answers

  • kthorngrenkthorngren Posts: 21,303Questions: 26Answers: 4,947

    Datatables doesn't have a built-in option for this.

    How do you want to re-order the cells (drag and drop, button, etc)?

    If drag and drop maybe you can use jQuery UI draggable or HTML5 draggable cells. You probably need to keep track of the original cell then once dropped use cell().invalidate() for both the source and destination cells. Or if you limit the move to one row you can use row().invalidate(). This will update the Datatables data cache with the changes.

    If you want to use a button or some other automated method then you would use cell().data() or row().data() to get and set the data.

    If this doesn't answer your question please provide more specifics on what you want to do.

    Kevin

This discussion has been closed.