Columns not sorting when using default search field
Columns not sorting when using default search field
pixelgeek
Posts: 18Questions: 2Answers: 0
I ran into an interesting issue recently. Viewable at http://wp.arcanewonders.com/mw/
If you filter the second table using the "Search all fields:" search field (its the default field added by DataTables) and then try to sort the results the table doesn't update. It sorts it internally but doesn't refresh the view. If you clear the field you can see it has sorted the data but just not displayed it.
Is there a way to override the display and force a refresh? Or is it a configuration issue? This is the code that I am using to init the table
[code]
listTable.dataTable({
oLanguage: { "sSearch": "Search all fields:"},
sDom: 'fptil',
sScrollY: "300px",
bPaginate:false,
aoColumnDefs: [{
aTargets:[0,1,2,3],
bSortable:true
}, {
aTargets:[4,5],
bSortable:false
}],
fnRowCallback:function(nRow) {
var tr = $(nRow)
$('td:nth-child(5)', tr).text(getCardAmount(tr))
}
})
[/code]
If you filter the second table using the "Search all fields:" search field (its the default field added by DataTables) and then try to sort the results the table doesn't update. It sorts it internally but doesn't refresh the view. If you clear the field you can see it has sorted the data but just not displayed it.
Is there a way to override the display and force a refresh? Or is it a configuration issue? This is the code that I am using to init the table
[code]
listTable.dataTable({
oLanguage: { "sSearch": "Search all fields:"},
sDom: 'fptil',
sScrollY: "300px",
bPaginate:false,
aoColumnDefs: [{
aTargets:[0,1,2,3],
bSortable:true
}, {
aTargets:[4,5],
bSortable:false
}],
fnRowCallback:function(nRow) {
var tr = $(nRow)
$('td:nth-child(5)', tr).text(getCardAmount(tr))
}
})
[/code]
This discussion has been closed.
Replies
Possibly bad timing, but I'm not actually seeing any tables on the page you linked to. DO I need to do something to make this visible?
Allan
So I think the problem comes from an old version of DataTables 1.10-wip. Could you try the latest DataTables from here http://datatables.net/download/build/nightly/jquery.dataTables.js ?
Thanks,
Allan
Thanks