Using variables with fnSort
Using variables with fnSort
I have a varity of custom sorts I need to implement and the logical approach is to pass variables to a sort function. The function works great with literals however not with variables. I could use a large switch statement with all the sort scenarios, but it seems like this should work.
Any ideas?
[code]
function sortTable(colSort, sortAD){
oTable.fnSort( [ [ colSort , sortAD ] ] );
}
[/code]
Any ideas?
[code]
function sortTable(colSort, sortAD){
oTable.fnSort( [ [ colSort , sortAD ] ] );
}
[/code]
This discussion has been closed.
Replies
1. oTable is a DataTables object which the function has has the correct scope to access?
2. colSort is an integer
3. sortAD is 'asc' or 'desc'
I'd suggest adding a console.log to check that these are all correct.
Allan
Thanks
Allan