Client-side filtering, server-side data?
Client-side filtering, server-side data?
I'm trying to get client-side filtering working while my data is supplied from the server.
This is *kind of* working -- in that my custom filter gets executed during the fnDraw() flow and the results are properly cut down...
But then when we get into the _fnDraw function there is this little snippet that kills my dreams of client side filtering:
[code]
var iStart = oSettings._iDisplayStart;
var iEnd = oSettings._iDisplayEnd;
if ( oSettings.oFeatures.bServerSide )
{
iStart = 0;
iEnd = oSettings.aoData.length;
}
[/code]
oSettings._iDisplayEnd was the correctly filtered length -- the server side data had already been obtained, and filtered, and oSettings.aiDisplay contains the correct, filtered number of rows, but that snippet replaces iEnd with the length of the data retrieved from the server, rather than the filtered dataset's length.
The following for loop then winds up creating rows for everything in aoData rather than just for what was in the already filtered aiDisplay.
I know DataTables supports server-side filtering, but I would really prefer to keep this filtering client-side to reduce the number of calls we are making to the server. I understand this might be difficult in the case where you have a large data set that it wouldn't be reasonable to load entirely into client-side memory, but this is not my particular use case... does anyone have any recommendations?
Thanks!
This is *kind of* working -- in that my custom filter gets executed during the fnDraw() flow and the results are properly cut down...
But then when we get into the _fnDraw function there is this little snippet that kills my dreams of client side filtering:
[code]
var iStart = oSettings._iDisplayStart;
var iEnd = oSettings._iDisplayEnd;
if ( oSettings.oFeatures.bServerSide )
{
iStart = 0;
iEnd = oSettings.aoData.length;
}
[/code]
oSettings._iDisplayEnd was the correctly filtered length -- the server side data had already been obtained, and filtered, and oSettings.aiDisplay contains the correct, filtered number of rows, but that snippet replaces iEnd with the length of the data retrieved from the server, rather than the filtered dataset's length.
The following for loop then winds up creating rows for everything in aoData rather than just for what was in the already filtered aiDisplay.
I know DataTables supports server-side filtering, but I would really prefer to keep this filtering client-side to reduce the number of calls we are making to the server. I understand this might be difficult in the case where you have a large data set that it wouldn't be reasonable to load entirely into client-side memory, but this is not my particular use case... does anyone have any recommendations?
Thanks!
This discussion has been closed.
Replies