Server-Side update: JSON variables should be explicitly converted
Server-Side update: JSON variables should be explicitly converted
DarkMortal
Posts: 3Questions: 0Answers: 0
This Bug is also applied to latest version 1.7.1
Using Server-Side Update with Ajax request.
In [code]_fnAjaxUpdateDraw[/code] you use assignment from JSON:
[code]
oSettings._iRecordsTotal = json.iTotalRecords;
oSettings._iRecordsDisplay = json.iTotalDisplayRecords;
[/code]
This makes [code]oSettings._iRecordsTotal[/code] and [code]oSettings._iRecordsDisplay[/code] to be String type because json provide variables' values as String.
This has side effect in Bug with incorrect [code]sInfo[/code] display, like
[code]Showing 1 to 0 of 0 entries[/code]
for empty sets. The reason is that you use [code]===[/code] operator in [code]_fnUpdateInfo[/code], like
[code]oSettings.fnRecordsDisplay() === 0[/code]
Using Server-Side Update with Ajax request.
In [code]_fnAjaxUpdateDraw[/code] you use assignment from JSON:
[code]
oSettings._iRecordsTotal = json.iTotalRecords;
oSettings._iRecordsDisplay = json.iTotalDisplayRecords;
[/code]
This makes [code]oSettings._iRecordsTotal[/code] and [code]oSettings._iRecordsDisplay[/code] to be String type because json provide variables' values as String.
This has side effect in Bug with incorrect [code]sInfo[/code] display, like
[code]Showing 1 to 0 of 0 entries[/code]
for empty sets. The reason is that you use [code]===[/code] operator in [code]_fnUpdateInfo[/code], like
[code]oSettings.fnRecordsDisplay() === 0[/code]
This discussion has been closed.
Replies
Allan
But I rather prefer this safe operation due to that fact that it throws errors if such variables were incorrectly passed as not integer.
If you do not agree please close this thread. Thanks!
Funny thing is that I haven't seen this question in the forum before, and now in about 2 days, there have been four posts about it. Did this come from a tutorial or something? Or just random coincidence?
Regards,
Allan