access to column name in formatter closure function
access to column name in formatter closure function
constantino
Posts: 2Questions: 1Answers: 0
I'm loving thing library, thank you very much for all your effort into making a solid piece of code!
I've got most of what I want implemented but there is a final part that I'm having trouble getting around. I'm using a formatter to do some data manipulations, however I need access to the column name within the closure function:
'formatter' => function( $d, $row ) {
return $column_name . $d; // how can I access the column name?
}
I've tried using something like
$column_name = array_search($d, $row);
which works fine until two columns exist that have the same $d value. How can I get around this?
Thanks!
This discussion has been closed.
Answers
This is in the demo server-side PHP script? There is no option for that at the moment. You would need to modify the demo code to add that ability.
Allan
Yep I've taken the demo as a starting point and modified it for my purposes. Could you show me a quick example of how I would modify it in order to access column name please?
Thanks!
The DataTables support options would cover this if you would like me to do the work for this.
Allan