DataTable position reset after using fnAddData
DataTable position reset after using fnAddData
radarseven
Posts: 1Questions: 0Answers: 0
First off, Allan, thanks for this amazing resource!
I'm having some trouble using [code]fnAddData[/code]. Basically the scenario is, I'm initializing a DataTable on the first page load. From there, I've setup infinite scrolling manually (not using the built-in version in 1.7.5) and am calling a function that retrieves JSON data from the server and adds it to my DataTable.
The problem is, on redraw, the scrollbar position always gets reset to the top of the DataTable. How can I maintain the scroll position after using fnAddData?
Here is my initial setup code:
[code]
var theTable = $( 'table.sortable' ).dataTable({
'bPaginate': false,
'bLengthChange': true,
'bFilter': false,
'bSort': true,
'bSortClasses': false,
'bInfo': false,
'bAutoWidth': false,
'bStateSave': false,
'bRetrieve': true,
'aaSorting': [[ 1, 'desc' ]],
'aoColumns': [
{
'bSortable': true
},
{
'sType': 'date',
'bSortable': true
},
{
'sType': 'natural',
'bSortable': true,
'asSorting': [ 'desc', 'asc' ]
},
{
'bSortable': true
}
]
});
[/code]
Thanks for your help!
I'm having some trouble using [code]fnAddData[/code]. Basically the scenario is, I'm initializing a DataTable on the first page load. From there, I've setup infinite scrolling manually (not using the built-in version in 1.7.5) and am calling a function that retrieves JSON data from the server and adds it to my DataTable.
The problem is, on redraw, the scrollbar position always gets reset to the top of the DataTable. How can I maintain the scroll position after using fnAddData?
Here is my initial setup code:
[code]
var theTable = $( 'table.sortable' ).dataTable({
'bPaginate': false,
'bLengthChange': true,
'bFilter': false,
'bSort': true,
'bSortClasses': false,
'bInfo': false,
'bAutoWidth': false,
'bStateSave': false,
'bRetrieve': true,
'aaSorting': [[ 1, 'desc' ]],
'aoColumns': [
{
'bSortable': true
},
{
'sType': 'date',
'bSortable': true
},
{
'sType': 'natural',
'bSortable': true,
'asSorting': [ 'desc', 'asc' ]
},
{
'bSortable': true
}
]
});
[/code]
Thanks for your help!
This discussion has been closed.
Replies
Allan