Server-side processing, return value indipendent from mysql result, how to?
Server-side processing, return value indipendent from mysql result, how to?

I need to return values with serverside processing. All is ok but I want to add a cell with custom values, indipendent from mysql result.
In my example i'd like to add a cell (index 2) with only a button.... but if I set db = '' (empty) I get syntax error....
If I omit all array for index 2, I get datatable error.
What is the best way to do this?
$primaryKey = 'ID';
$columns = array(
array(
'db' => 'ID',
'dt' => 'DT_RowId',
'formatter' => function( $d, $row ) {
return 'row_'.$d;
}
),
array(
'db' => 'Name',
'dt' => 0,
'formatter' => function( $d, $row ) {
return $d;
}
),
array(
'db' => 'Price',
'dt' => 1,
'formatter' => function( $d, $row ) {
return '<input type="text" class="form-control number price" value="' . $d . '">';
}
),
array(
'db' => '', //<-----------------------error
'dt' => 2,
'formatter' => function( $d, $row ) {
return '<button class="btn-delete-row">DELETE</button>';
}
),
array(
'db' => 'tax',
'dt' => 3,
'formatter' => function( $d, $row ) {
return $d;
}
),
This discussion has been closed.
Answers
This thread should help, it's asking the same thing.
Cheers,
Colin