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

MrBaseball34MrBaseball34 Posts: 96Questions: 0Answers: 0
edited March 2011 in General
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.

Replies

  • MrBaseball34MrBaseball34 Posts: 96Questions: 0Answers: 0
    nevermind. I found fnRowCallback and it's working for me. I forgot that I was also modifying the first column to have a checkbox.
  • MrBaseball34MrBaseball34 Posts: 96Questions: 0Answers: 0
    FYI...
    [code]
    "fnRowCallback": function( nRow, aData, iDisplayIndex ) {
    $('td:eq(0)', nRow).html('');
    $('td:eq(1)', nRow).html('
This discussion has been closed.