Function name must be a string on Server Side Processing
Function name must be a string on Server Side Processing
baokydev
Posts: 3Questions: 3Answers: 0
$columns = array(
array(
'db' => 'contact_id',
'dt' => 'DT_RowId',
'formatter' => function( $d, $row ) {
// Technically a DOM id cannot start with an integer, so we prefix
// a string. This can also be useful if you have multiple tables
// to ensure that the id is unique with a different prefix
return 'row_'.$d;
}
),
array( 'db' => 'contact_name', 'dt' => 'contact_name' ),
array( 'db' => 'contact_email', 'dt' => 'contact_email' ),
array( 'db' => 'contact_type', 'dt' => 'contact_type' )
);
I have the code above, the error return was function name must be a string
I think it refer to this part
'formatter' => function( $d, $row ) {
// Technically a DOM id cannot start with an integer, so we prefix
// a string. This can also be useful if you have multiple tables
// to ensure that the id is unique with a different prefix
return 'row_'.$d;
}
This code is copy from DataTable page on server processing, row detail. I just copy the exact but no idea why it return me this function name must be a string, how do I rectify this function name must be a string issue.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Sounds like you might be using a very old version of PHP. An anonymous function, such as that above, requires PHP 5.3 or newer.
Allan