columns.orderData

columns.orderData

krutovdlkrutovdl Posts: 35Questions: 7Answers: 1

I recently used this sorting feature and it is a very useful function indeed. However, the only way to reference another column is by its index number such as orderData: [0]. Instead of using the column index number, is there a way to use the actual column name like orderData: ["Column1"] for readability reasons?

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 20,276Questions: 26Answers: 4,765
    Answer ✓

    The columns.orderData state that it expects integer indexes. Using a name won't work. You could create a var Column1 and assign it the column index and use orderData: [Column1].

    You may be interested in this other thread from today. The developers can comment if they are looking at doing something similar with columns.orderData.

    Kevin

  • krutovdlkrutovdl Posts: 35Questions: 7Answers: 1

    order: [['Column1:name', 'asc']] because my employer is requiring me to use DataTables() rather than dataTables().

    Te be consistent, i would expect an overload function to exist for orderData that expects a string array parameter and converts it to an integer array. Then would work as it currently does which just expects an integer array.

This discussion has been closed.