Use a variable name for sorting on a hidden column (instead of iDataSort)

Use a variable name for sorting on a hidden column (instead of iDataSort)

trhaynestrhaynes Posts: 4Questions: 0Answers: 0
edited May 2012 in General
I love that I can specify an mDataProp for column data instead of using an integer. This makes reordering columns easy.

But it looks like I have to use iDataSort to sort by a different column, which is frustrating. That means I have to add the column to the table, hide it, and then tell my other column which # it is.

This would be way better to sort my (human-readable) "last_login" column by the (sortable) "last_login_sorting" column:

[code]
{
'aTargets': ['last_login'],
'mDataProp': 'last_login',
'mDataSort': 'last_login_sorting'
},
[/code]

Is there a way to do this that I'm missing? Or a reason this isn't supported?

Thanks.

-tom

Replies

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    > Is there a way to do this that I'm missing?

    I'm afraid not - you aren't missing anything.

    > Or a reason this isn't supported?

    Yes - it hasn't been implemented yet. Much better support for column naming like this is planned for 1.10 where you will be able to use sName to reference each column independently and in a nice easy to read fashion.

    Having said that, given what you want to do, you might want to take a look at this blog post which describes how to use different data for the different actions that DataTables takes: http://datatables.net/blog/Orthogonal_data .

    Allan
  • trhaynestrhaynes Posts: 4Questions: 0Answers: 0
    Using mDataProp as a function works perfectly, thanks!
This discussion has been closed.