0

Ok I am using DataTables from Datatables.net I have one table that seems to be suffering a sort issue. Currently "aoColumns" is set up like

null,
{"iDataSort": 2, "bSortable": true},
{"bVisible": true, "sType": "num"},
{"iDataSort": 4, "bSortable": true},
{"bVisible": true, "sType": "num"}

What it is is 5 columns 2 of which are hidden so.. 0 is the column with the inital sort issue that sparked this post. 1 is supposed to be display purpose only 2 is hidden and is supposed to act as the sort for 1 3 is supposed to be display purpose only 4 is hidden and supposed to act as the sort for 3

I need the first column to recognize as html so it strips out the HTML as it has links in it, currently its set to null and the problem with this is it breaks the sorting in Chrome.

I have tried to make it like

{"sType": "html", "bSortable": true},
{"iDataSort": 2, "bSortable": true},
{"bVisible": true, "sType": "num"},
{"iDataSort": 4, "bSortable": true},
{"bVisible": true, "sType": "num"}

Which breaks the table itself.

First I tried

{ "sType": "html", "bSortable": true},
{ "sType": "num", "bSortable": true},
{ "sType": "num", "bSortable": true}

(before I realized I had 2 hidden columns) Which this worked but broke the table layout physically. So now Im stuck trying to go from a to b keeping all 5 columns the 3 displayed, and the 2 hidden and failing

1 Answer 1

2

Try this:

aoColumns: [
   {"sType": "html", "bSortable": true},
   {"iDataSort": 2, "bSortable": true, "bUseRendered":false},
   {"bVisible": true, "sType": "numeric"},
   {"iDataSort": 4, "bSortable": true, "bUseRendered":false},
   {"bVisible": true, "sType": "numeric"}
]

I had to do this with a column that rendered images instead of the values and then created a hidden column which had the actual values to sort on.

I hope this helps

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.