Sorting on hidden data

Sorting on hidden data

nskwortsownskwortsow Posts: 120Questions: 0Answers: 0
edited November 2012 in DataTables 1.9
Hi,

I am using mRender to draw a bar chart of a value.

How can I sort this column of bar charts, based on the value of [code]val[/code]?

[code]
{ "mData": "PCx","sDefaultContent": "",
"mRender": function(val,type,row){
return '';
}
[/code]

Replies

  • nskwortsownskwortsow Posts: 120Questions: 0Answers: 0
    > never mind, I found a workaround.
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    One way to do it is described in this blog post: http://datatables.net/blog/Orthogonal_data . Basically you'd return the data that you want to sort on when DataTables requests sort data, and whatever else (the chart) when the display is requested.

    Another option is to have a hidden column and use aDataSort to force the column with the chart in it to sort on the hidden column.

    A final option is to use sType and a custom sorting method to pull the data out of the HTML (the width) and then sort on that :-)

    Allan
This discussion has been closed.