"aoColumns": [
{ "mDataProp": "fullname" },
{ "mDataProp": "extended.0" },
{ "mDataProp": "user_group" },
{ "mDataProp": "gender" },
]
$aColumns = array( 'fullname','extended','user_group','gender');
{
"check_in_date":"5",
"check_in_month":"04",
"check_in_year":"2011",
"institution":"Choice 2",
"degree":"Choice 2",
"field_of_study":
"Electornics and Computer Engineering",
"major":"Engineering",
"year_of_study":"Choice 2",
"gpa":"Choice 2",
"motivational":"Motivated",
"industry":"Choice 2",
"duration":"2","employment":"1",
"renumeration":"0",
}
{ "aaData": [
{
"engine": "Trident",
"browser": "Internet Explorer 4.0",
"platform": {
"inner": "Win 95+",
"details": [
"4",
"X"
]
}
}
] }
{ "aaData": [
{
"engine": "Trident",
"browser": "Internet Explorer 4.0",
"platform": "{
"inner": "Win 95+",
"details": [
"4",
"X"
]
}"
}
] }
"aoColumns": [
{ "mDataProp": "fullname" },
{ "mDataProp": "extended" },
{ "mDataProp": "user_group" },
{ "mDataProp": "gender" }
]
$aColumns = array('fullname','extended','user_group','gender');
{
"sEcho": 0,
"iTotalRecords": "5",
"iTotalDisplayRecords": "5",
"aaData": [
{
"fullname": "Job King'ori Maina",
"extended": "{\"check_in_date\":\"5\",\"check_in_month\":\"04\",\"check_in_year\":\"2011\",\"institution\":\"Choice 2\",\"degree\":\"Choice 2\",\"field_of_study\":\"Electornics and Computer Engineering\",\"major\":\"Engineering\",\"year_of_study\":\"Choice 2\",\"gpa\":\"Choice 2\",\"motivational\":\"Motivated\",\"industry\":\"Choice 2\",\"duration\":\"2\",\"employment\":\"1\",\"renumeration\":\"0\",\"login-updprof-btn\":\"Update Profile\"}",
"user_group": "3",
"gender": "1"
}
]
}
{
"check_in_date": "5",
"check_in_month": "04",
"check_in_year": "2011",
"institution": "Choice 2",
"degree": "Choice 2",
"field_of_study": "Electornics and Computer Engineering",
"major": "Engineering",
"year_of_study": "Choice 2",
"gpa": "Choice 2",
"motivational": "Motivated",
"industry": "Choice 2",
"duration": "2",
"employment": "1",
"renumeration": "0",
"login-updprof-btn": "Update Profile"
}
while ( $aRow = mysql_fetch_array( $rResult ) )
{
$row = array();
for ( $i=0 ; $i<count($aColumns) ; $i++ )
{
if ( $aColumns[$i] == "extended" )
{
/* Special data handling for 'extended' column with JSON object */
$row[ $aColumns[$i] ] = json_decode($aRow[ $aColumns[$i] ]);
}
else if ( $aColumns[$i] != ' ' )
{
/* General output */
$row[ $aColumns[$i] ] = $aRow[ $aColumns[$i] ];
}
}
$output['aaData'][] = $row;
}
echo json_encode( $output );
{ "mDataProp": "extended.institution" }
$('#example').dataTable( {
"bFilter": false,
"bPaginate": false,
"bInfo": false,
"bJQueryUI": true,
"bSort": false,
"bProcessing": false,
"sAjaxSource": "url",
"aoColumns": [
{"sTitle": "Status", "mDataProp": "requestStatus.status" },
{"sTitle": "Mission", "mDataProp": "overview.feedOverview.status" } ] });
overview.feedOverview.0.status
"aoColumns": [
{
"mDataProp": "someKey",
"fnRender": function (o) {
var v = o.aData[this.mDataProp];
// return 'v' with formatting
}
}
]
"fnRender": function (o, v) {
// return 'v' with formatting
}
It looks like you're new here. If you want to get involved, click one of these buttons!
Get useful and friendly help straight from the source.