doubt regarding dataSrc
doubt regarding dataSrc
Srilakshmi
Posts: 35Questions: 6Answers: 0
Hi Allan,
I am using server side processing,
my doubt is regarding return type of "dataSrc",
if I use
" dataSrc": function ( json ) {
MasterProducts = hostXmlToJson(json);
var json = JSON.stringify(MasterProducts);
var result = json ;
var obj = JSON.parse(result);
return obj.data;
}
it works fine, but the paging information is not proper, as it comes as Showing 0 to 0 of 0 entries (filtered from NaN total entries),
to solve this issue i used the following code
" dataSrc": function ( json ) {
MasterProducts = hostXmlToJson(json);
var json = JSON.stringify(MasterProducts);
var result = json ;
var obj = JSON.parse(result);
return {
recordsTotal: 500, //500 used for checking purpose
recordFiltered: 30,//30 used for checking purpose
data: obj.data
};
}
in this case data does not appear in the table at all.
looking forward for a reply,
Srilakshmi
This discussion has been closed.
Answers
Hi,
Just a quick note, the Markdown formatting guidelines might be of some interest for syntax highlighting etc. I've edited your post above to ad syntax highlighting.
There is no option in server-side processing mode to change the location of the
recordsTotal
, etc parameters - they must be at the top level of the JSON object returned. Theajax.dataSrc
option is only for the data source.Allan
Thanks allan :-)