Sorting by column containing fields

Sorting by column containing fields

rmunerarmunera Posts: 2Questions: 1Answers: 0

I want to use datatables to edit database columns. to do so I'm adding input fields using columnDefs. However, the column will no longer sort (I assume this is due to the complex value of the table cell).
I tried using the columns.data option but that only formatted the data before the render function. Is there a way to have datatables sort the dataset using the columns provided?

Here's what I'm doing:

http://jsfiddle.net/Rodmunera/7jemahxz/3/

Answers

  • ThomDThomD Posts: 334Questions: 11Answers: 43

    If those are going to be input fields that get written back to your data source, you need the Editor library.

  • rmunerarmunera Posts: 2Questions: 1Answers: 0

    Well, it's more nuanced than that. Unfortunately editor does not support what I want to do, so I'm left with doing it this way. I could just do all my data sorting on the server, but I was trying to have datatables handle that, maybe using some sort of column / row metadata?

  • ThomDThomD Posts: 334Questions: 11Answers: 43

    There are a couple of reset discussions on sorting a column based on the value of another column. You can hide the "clean" data in another column and reference that.

    https://datatables.net/reference/option/columns.orderData

This discussion has been closed.