Automatic row ID addition in datatables (jQuery)
Automatic row ID addition in datatables (jQuery)
dyapasrikanth
Posts: 20Questions: 0Answers: 0
Hi to all i am a java programmer. I can't understand PHP code that what is given as example for ROWID, ROWCLASS. Pls help in order to construct JSON data in java.
What is an expected output format for JSON data in order to send ROWID and ROWCLASS attributes to datatables from java.
This is my output format
{"iTotalRecords":21,
"iTotalDisplayRecords":21,
"aaData":[
[1,"dves","fe323cdf","dfeffwecwe",23,"asdfasf"],
[2,"cew","ewe3cdf","dfeffwecwe",33,"asdfasf"],
[3,"ewf","bv3df","dfeffwecwe",34,"fefwwfdfasf"],
[4,"fwe","ew3cdf","dfeffwecwe",30,"sdfa asdfasf"]
]}
for this one i created an object of this class
public class DTSerializedObject implements java.io.Serializable
{
public int iTotalRecords;
public int iTotalDisplayRecords;
public ArrayList aaData;
}
then i passed that object to flexjson JSONSerializer class to get desired format.
What is an expected output format for JSON data in order to send ROWID and ROWCLASS attributes to datatables from java.
This is my output format
{"iTotalRecords":21,
"iTotalDisplayRecords":21,
"aaData":[
[1,"dves","fe323cdf","dfeffwecwe",23,"asdfasf"],
[2,"cew","ewe3cdf","dfeffwecwe",33,"asdfasf"],
[3,"ewf","bv3df","dfeffwecwe",34,"fefwwfdfasf"],
[4,"fwe","ew3cdf","dfeffwecwe",30,"sdfa asdfasf"]
]}
for this one i created an object of this class
public class DTSerializedObject implements java.io.Serializable
{
public int iTotalRecords;
public int iTotalDisplayRecords;
public ArrayList aaData;
}
then i passed that object to flexjson JSONSerializer class to get desired format.
This discussion has been closed.
Replies
Have a look also at this blog which takes about mDataProp which you will need for DT_RowId to work (since you will be working with objects, not arrays): http://datatables.net/blog/Extended_data_source_options_with_DataTables
Allan
Is JSON output should be like this
{"iTotalRecords":21,
"iTotalDisplayRecords":21,
"aaData":[
{"DT_RowClass":"special","col1":1,"col2":"dves","col3":"fe323cdf","col4":"dfeffwecwe","col5":23,"col6":"asdfasf"},
.............
]}
I don't know how to use Firebug to see the XHR