Adding links to data to be returned as JSON in server-side processing
Adding links to data to be returned as JSON in server-side processing
MrBaseball34
Posts: 96Questions: 0Answers: 0
In the code below I need to add the anchor tag to the data returned for column i.inventory_id.
[code]
while ( $aRow = $db->fetchArray( $rResult ) ) {
$row = array();
foreach($aColumns as $name=> $value) {
if($name =='i.inventory_id') {
$row[] = ""
} else {
$row[] = $aRow[$name];
}
}
$output['aaData'][] = $row;
}
echo json_encode( $output );
[/code]
I'm using this as server-side data for my DataTable.
When I do it like this. I get an error that the JSON is not formatted correctly.
How would I need to format this to be returned correctly or can I do this at all? I cannot add the link at the UI end without modifying the plugin's code and it is used in another area of the site where the data is different.
[code]
while ( $aRow = $db->fetchArray( $rResult ) ) {
$row = array();
foreach($aColumns as $name=> $value) {
if($name =='i.inventory_id') {
$row[] = ""
} else {
$row[] = $aRow[$name];
}
}
$output['aaData'][] = $row;
}
echo json_encode( $output );
[/code]
I'm using this as server-side data for my DataTable.
When I do it like this. I get an error that the JSON is not formatted correctly.
How would I need to format this to be returned correctly or can I do this at all? I cannot add the link at the UI end without modifying the plugin's code and it is used in another area of the site where the data is different.
This discussion has been closed.
Replies
[code]
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
$('td:eq(0)', nRow).html('');
$('td:eq(1)', nRow).html('