Sort table with some criteria

Sort table with some criteria

ZPetrovichZPetrovich Posts: 0Questions: 0Answers: 0
edited November 2012 in General
JQuery's DataTables has very poor docs. So sorry for maybe trivial question.

I want for filter my table by some string on some column. Here is mine code:

[code]
var str = "days";
my_table.fnFilter(str, 9);
[/code]

I expect to have only rows that contains "days" string at 9 column (counting from 0). But above code does not bring me result

I have tried to use this code with RexEx:

[code]
var regEx = "days";
my_table.fnFilter(regEx, 9, true);
[/code]

this code:

[code]
var regEx = "^days$";
my_table.fnFilter(regEx, 9, true);
[/code]

and this code:

[code]
var regEx = ".*days.*";
my_table.fnFilter(regEx, 9, true);
[/code]

All without luck. I am sure my table has "101 days" string at 9 column. What am I doing wrong?

I have custom type for my column:
[code] jQuery.fn.dataTableExt.oSort['days-asc'] = function (a, b) {
var x = parseInt((trim(a) == "") ? 0 : trim(a.replace(/days/, "")));
var y = parseInt((trim(b) == "") ? 0 : trim(b.replace(/days/, "")));
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
};

jQuery.fn.dataTableExt.oSort['days-desc'] = function (a, b) {
var x = parseInt((trim(a) == "") ? 0 : trim(a.replace(/days/, "")));
var y = parseInt((trim(b) == "") ? 0 : trim(b.replace(/days/, "")));
return ((x < y) ? 1 : ((x > y) ? -1 : 0));
};[/code]
This discussion has been closed.