Closed walliby closed 10 years ago
Please use virtualFields instead. http://book.cakephp.org/2.0/en/models/virtual-fields.html
I'm using virtual fields but when I use the search field of the datatable, the query brokes since it cannot do OR ((GROUP_CONCAT(DISTINCT Pharmacy
.name
SEPARATOR ', ')) LIKE '%Sa%')
Is there a way to tell the component not to filter on that field?
Yes you do this in the dataTables options in your JS code. Set {bSearchable: false} in your aoColumns for the fields that you should not be searching on.
I am not able to filter or sort on a field created with GROUP_CONCAT as shown below. I get a database error (Column not found: 1054 Unknown column '0.usergroups' in 'where clause'). Are you aware of any workaround for this issue?
$this->paginate = array( 'fields' => array('User.id','PersonUser.sort_name_classes','PersonUser.user_name'), 'order' => 'PersonUser.sort_name_classes', 'group' => array('User.id','PersonUser.sort_name_classes'), 'link' => array('UserGroup' => array('fields' => 'GROUP_CONCAT(UserGroup.group) as usergroups'),'PersonUser'));
$this->DataTable->fields = array('User.id','PersonUser.sort_name_classes','PersonUser.user_name','0.usergroups');