Server-Side Update: Need aditional JSON response variable to reset current page

Server-Side Update: Need aditional JSON response variable to reset current page

DarkMortalDarkMortal Posts: 3Questions: 0Answers: 0
edited August 2010 in Bug reports
Currently there is no ability to reset current page using Server-Side Update mechanism.
Problem:
We have 100 entries and page that shows entries from 91 to 100.
We have updated server data to have now only 50 records.
So when dataTables requested data from server we have no opportunity to say that we have no enough entries and need to reset page to the first one.

Now:
DataTables will show [code]Showing 91 to 100 of 50 entries[/code]

Expected:
Reset to the first page.

Possible Solution:
Add new JSON variable to be sent by server:[code]iResetStart[/code]
If it equals to 1 then dataTables should reset current page to the first one. Otherwise do nothing.

[code]
function _fnAjaxUpdateDraw ( oSettings, json )
{
...
_fnClearTable( oSettings );
oSettings._iRecordsTotal = json.iTotalRecords;
oSettings._iRecordsDisplay = json.iTotalDisplayRecords;
//Fix
if (parseInt(json.iResetStart)===1)
oSettings.iInitDisplayStart=0;
//End of Fix

/* Determine if reordering is required */
var sOrdering = _fnColumnOrdering(oSettings);
...
[/code]

Replies

  • allanallan Posts: 63,535Questions: 1Answers: 10,475 Site admin
    If I understand correctly (actually even if not!) I think there is a bug in DataTables around the area. For example, do the following on each of the two pages below:

    1. Load page
    2. Page forward to rows 41 - 50.
    3. Use the length menu to change to '100' records
    4. Observe different behaviour.

    http://datatables.net/examples/basic_init/zero_config.html
    http://datatables.net/examples/server_side/server_side.html

    If I understand correctly, you would be expecting something like in the first example?

    To be fixed...

    Allan
This discussion has been closed.