Selectively turning on user ordering/searching for columns with HTML5 data attributes

Selectively turning on user ordering/searching for columns with HTML5 data attributes

fxufxu Posts: 3Questions: 1Answers: 0

Description of problem:

I want to turn off user ordering and searching for all columns by default. This is something that I have achieved by setting

{"targets": "_all", "orderable": false, "searchable": false}

in columnDefs.

So far so good. But now I want to selectively turn it back on for individual columns with HTML5 data attributes by setting data-orderable="true" or data-searchable="true" in <th> inside the table header. Unfortunately this doesn't work, it seems that the above in the columnDefs overwrites the data attributes.

The alternative right now is not to set above in columnDefs and then litter all my templates with data-orderable="false" data-searchable="false" attributes. That doesn't seem very elegant to me.

Is there a better way to achieve this?

Replies

Sign In or Register to comment.