setting aoColumns options with variable columns
setting aoColumns options with variable columns
Hello, i'm trying to set sType on my table to enable custom sorting, but my function is called in 2 ways, each of which will return a different number of columns. Therefore I cannot use a static array for aoColumns, how can I get around this?
thanks in advance
thanks in advance
This discussion has been closed.
Replies
jQuery.fn.dataTableExt.oSort['formatted-num-desc'] = function(x,y){
x = x.replace(/[^\d\-\.\/]/g,'');
y = y.replace(/[^\d\-\.\/]/g,'');
if(x.indexOf('/')>=0)x = eval(x);
if(y.indexOf('/')>=0)y = eval(y);
return x/1 - y/1;
}
jQuery.fn.dataTableExt.oSort['formatted-num-asc'] = function(x,y){
x = x.replace(/[^\d\-\.\/]/g,'');
y = y.replace(/[^\d\-\.\/]/g,'');
if(x.indexOf('/')>=0)x = eval(x);
if(y.indexOf('/')>=0)y = eval(y);
return y/1 - x/1;
}
how can I set a new auto type detection for this? I have seen the one for comma as decimal point, but not for the plugin.
jQuery.fn.dataTableExt.aTypes.push(
function ( sData )
{
var sValidChars = "0123456789-,";
var Char;
var bDecimal = false;
/* Check the numeric part */
for ( i=0 ; i
I like questions like that ;-)
Good to hear you got it sorted,
Allan