How do i use function fnPriority more times?

How do i use function fnPriority more times?

Joseph777Joseph777 Posts: 1Questions: 0Answers: 0
edited April 2013 in General
Hi,

How do i use function fnPriority more times?

This code do not work (work only second fnPriority).
[code] function fnPriority( a )
{
if ( a == 'mega' ) { return 1; }
else if ( a == 'giga' ) { return 2; }
else if ( a == 'tera' ) { return 3; }
return 0;
}

function fnPriority( a )
{
if ( a == 'slow' ) { return 1; }
else if ( a == 'normal' ) { return 2; }
else if ( a == 'fast' ) { return 3; }
return 0;
}


jQuery.fn.dataTableExt.oSort['priority-asc'] = function(a,b) {
var x = fnPriority( a );
var y = fnPriority( b );

return ((x < y) ? -1 : ((x > y) ? 1 : 0));
};

jQuery.fn.dataTableExt.oSort['priority-desc'] = function(a,b) {
var x = fnPriority( a );
var y = fnPriority( b );

return ((x < y) ? 1 : ((x > y) ? -1 : 0));
};
[/code]
This discussion has been closed.