Add filtering to a ReorderController
0
Add this snippet to your controller's _reorder_toolbar.htm
partial:
<input name="filter-records" type="text" class="form-control icon search growable"
data-request="onFilterRecords"
data-track-input
/>
Add this to your Controller class:
public function onFilterRecords()
{
$reorderController = $this->asExtension('ReorderController');
$reorderController->reorder();
return [
'#reorderRecords' => $reorderController->reorderMakePartial('records', ['records' => $reorderController->vars['reorderRecords']]),
];
}
public function reorderExtendQuery($query)
{
if ($term = Input::get('filter-records')) {
$query->where('name', 'like', "%$term%");
}
}
There are no comments yet
Be the first one to comment