forked from fheider/cakephp-datatables
-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Description
This is a weird one, clearly I'm doing something wrong, just wondering if you can point me to the right direction.
When i let my INT columns be searchable, the search field doesn't accept string values (Err: Cannot convert value of type string to integer), however when I specify my INT columns with 'searchable' => false and I mean all of them, the string columns become searchable, but not the int columns obviously.
My Controller
$columns = [
[
'field' => 'BigDatas.id', //INT Column
'data' => 'id',
],
[
'title' => __('Amount'), //String Column
'field' => 'BigDatas.amount',
'data' => 'amount',
],
[
'title' => __('Unit'), //INT Column
'field' => 'BigDatas.unit',
'data' => 'unit',
],
[
'title' => __('Stir'), //String Column
'field' => 'BigDatas.stir',
'data' => 'stir',
]
];
$data = $this->DataTables->find('BigDatas', 'all', [
'order' => ['id' => 'asc']
], $columns);
$this->set('columns', $columns);
$this->set('data', $data);
$this->set('_serialize', array_merge($this->viewVars['_serialize'], ['data']));
My Template
$options = [
'ajax' => [
'url' => $this->Url->build() // current controller, action, params
],
'data' => $data,
'deferLoading' => $data->count(),
'columns' => $columns,
'order' => [0, 'asc'],
];
echo $this->DataTables->table('bigdatas-table', $options, ['class' => 'table table-striped']);
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels