PHP libraries - Custom column ( not in database )
PHP libraries - Custom column ( not in database )

I'm using PHP libraries and i need a custom column that is not in the database
For example : a table has columns C1, C2
I need a custom column B that is created using C1 and C2
i am using this solution now :
Field::inst( 'C1'),
Field::inst( 'C2'),
Field::inst( 'C1', 'B')
->set( false )
->getFormatter( function ( $val, $data ) { ...custom code ... }),
so i am reusing one of the existing columns (C1 in this example) and name it B
and also ->set( false )
Is there a better way to do this ?
This question has accepted answers - jump to:
This discussion has been closed.
Answers
Hi @cr1st1 ,
This example should help - I think it's doing what you're looking for,
Cheers,
Colin
Thank you @colin,
this is a solution if you want to create the custom column on the javascript side but unfortunately i need to create the custom column on the server side, on PHP side.
Do you have a solution using DataTables PHP libraries ?
The solution you have above is the best way of doing it if you want it done in PHP. However, personally I would suggest that you use a client-side data renderer if the server-side needs to know nothing about that column (i.e. its purely a client-side construct).
What what we do for the Name column in this example.
Allan