Closed tomwoj6 closed 9 years ago
Is there any possibility to merge data from 2 fields from db into one field in datatables? Something like that:
->setFields( array( "fielddt" => 'field_db_1 + field_db_2', "_identifier_" => 'vac.id') )
Ofcourse I can achieve this using querybuilder:
$qb->from("BSHrBundle:Vac", "vac") ->leftJoin('x.author', 'author') ->select('x') ->addSelect("CONCAT(x.firstname, ' ', x.lastname) as fullUsername"); $datatable = $this->get('datatable') ->setFields( array( "Column 1 label" => 'fullUsername', "_identifier_" => 'vac.id') ) ->setHasAction(FALSE) ->setSearch(TRUE); $datatable->getQueryBuilder()->setDoctrineQueryBuilder($qb);
but later I can't search by that field. I am getting this error: [Syntax Error] line 0, col 82: Error: Expected '.' or '(', got 'fullUsername'
[Syntax Error] line 0, col 82: Error: Expected '.' or '(', got 'fullUsername'
Thanks in advance.
@tomwoj6 use dt_obj as described in https://github.com/AliHichem/AliDatatableBundle#-custom-renderer
Is there any possibility to merge data from 2 fields from db into one field in datatables? Something like that:
Ofcourse I can achieve this using querybuilder:
but later I can't search by that field. I am getting this error:
[Syntax Error] line 0, col 82: Error: Expected '.' or '(', got 'fullUsername'
Thanks in advance.