Infinite Scrolling with column filters
Infinite Scrolling with column filters
When using infinite scrolling and column filters the table row of the filter input elements are on the bottom of the table and there is no way to reach them, since if you scroll down new data is fetched and the filters row is again at the bottom. Is there any way to make the filters row fixed like the header?
Thank you.
Thank you.
This discussion has been closed.
Replies
Allan
Thank you for the immediate response.
Maybe I was not very clear. I am using the tfoot element as in the example and it is indeed always at the bottom of the table, but since the table has vertical scroll, I have to scroll down to find the input elements for the filters. But when you scroll down with infinte scrolling data is fetched and you can never reach the end of the table (only when there is no more data to be fetched.
In the example you mentioned there is no scrolling, or maybe I do not understand what you mean?
Thank you again.
Allan
Let me be a little bit more specific. I am using ajax as a datasource to fetch data for infinite scrolling.
this is my setup, copied from your example:
[code]
var firstTime = true;
var oTable, oSettings, oHeader;
var oLoadParams = {
iDataStart: 0,
iDataLength: 100,
iLock: false
};
function fnAddAjaxData()
{
oLoadParams.iLock = true;
$.getJSON(
oTable.fnSettings().sAjaxSource +
"?iStart="+ oLoadParams.iDataStart +
"&iLength="+ oLoadParams.iDataLength,
function(json) {
// json.aaData = json.dsLogList; // this assignmenet is needed because the plugin requires a variable named aaData
oTable.fnAddData(json.aaData);
oLoadParams.iDataStart = oLoadParams.iDataStart + json.aaData.length;
oLoadParams.iLock = false;
}
);
}
oTable = $('#logsTable').dataTable( {
"sDom": 'lfr<"scroller"t>ip',
"bPaginate" : false,
"sAjaxSource" :"showNextConsoleData",
"bAutoWidth" : false,
} );
oHeader = new FixedHeader( oTable );
oSettings = oTable.fnSettings();
fnAddAjaxData();
$('div.scroller').scroll( function() {
if (!oLoadParams.iLock)
{
if ( $(this).scrollTop() + $(this).height() >
$(oSettings.nTable).height() - 100 )
{
fnAddAjaxData();
$('div.scroller').focus();
}
}
} );
[/code]
and this is my html table:
[code]
ID
TMS
PID
TID
Service
Job
Level
Text
SrcFunc
SrcFile
[/code]
The difference in the scroll_y_infinite example as i saw it is that you add a parameter "sScrollY": "200px"
When I tried to use it I get a js alert "FixedHeader 2 is not supported with DataTables' scrolling mode at this time".
Also, I get an horizontal scroller where without it I did not have any, but that might have to do with the rest of my layout.
Allan
I am sorry but I am not sure what you mean. Am I doing something wrong? This is code from an example I found, is there a different way to do infinite scrolling with ajax loading?
Thank you.