realtebo
realtebo

Reputation: 25681

Datatables 1.9.4: data-order attribute is ignored

Prologue: My table is rendered server-side and then, client-side, is enanched by Datatables, version 1.9.4. So, no ajax-related issues

I've a column with a money amount per cell. Actually, sorting it I obtain that

etc..

So i tried adding to every TD a data-sort attribute to use the numeric value instead of formatted one.

But Sorting is absolutely ignoring it.

Must I enable in some way or install a plugin?

Upvotes: 0

Views: 454

Answers (1)

Dani
Dani

Reputation: 2036

Use columnDefs, field type num as the documentation says

$('#TableId').dataTable({
  ...
  "columnDefs": [
    { "type": "num", targets: 3 } // Change targets to your column number, it starts in 0
  ]
  ...
});

Upvotes: 1

Related Questions