yii2-datatables
yii2-datatables copied to clipboard
filter with multiple tables in one page
Hello,
I have multiple tables in one page and my row filtering won't works. Wth one table, its working.
the error i get in console is: TypeError: preSearch[column] is undefined jquery.dataTables.js:9072:6
hello @nrob81 please provide part of source code where you call datatables widgets
foreach ($content['tables'] as $tableId => $table) {
foreach ($table['columns'] as $key) {
$column = [
'data' => $key,
'title' => $model->getAttributeLabel($key),
];
$columns[] = $column;
}
echo \nullref\datatable\DataTable::widget([
'data' => $table['data'],
'columns' => $columns,
'paging' => false,
'ordering' => false,
'info' => false,
'withColumnFilter' => true,
'id' => $tableId,
]);
}
Thanks, I'll try to reproduce it It will be useful if you could add full stack trace of JS error from console
TypeError: preSearch[column] is undefined[Learn More] 3 jquery.dataTables.js:9072:6
<anonymous> http://r.local/assets/4a415d84/js/jquery.dataTables.js:9072:6
iterator http://r.local/assets/4a415d84/js/jquery.dataTables.js:7057:14
<anonymous> http://r.local/assets/4a415d84/js/jquery.dataTables.js:9067:11
_api_registerPlural/< http://r.local/assets/4a415d84/js/jquery.dataTables.js:7311:14
methodScoping/< http://r.local/assets/4a415d84/js/jquery.dataTables.js:7195:16
<anonymous> http://r.local/kontrolny/default/index:870:17
dispatch http://r.local/assets/771ef92b/jquery.js:4736:16
add/elemData.handle http://r.local/assets/771ef92b/jquery.js:4549:6
Hey @nrob81 Sorry, but I can't reproduce this kind of issue with last dev-master version. Also, I found another issue connected with multiple tables with filters on one page. Please, check my examples here. If you still have an issue, please contact me, we try to resolve it individually.