I added a search in each column of the table using the initComplete method. But I need to change something, and I don't know how.
How to add search cells to the table header (under the column names);
How to make search cells only on the second and third columns, and not on all.
public function html()
{
return $this->builder()
->setTableId('format-table')
->columns($this->getColumns())
->minifiedAjax()
->select()
->initComplete("function () {
this.api().columns().every(function () {
var column = this;
var input = document.createElement(\"input\");
$(input).appendTo($(column.footer()).empty())
.on('change', function () {
column.search($(this).val(), false, false, true).draw();
});
});
}")
->serverSide()
->dom('B<"top"i>rt<"bottom"flp><"clear">')
->orderBy(1, 'asc')
->buttons(
Button::make('create')->editor('editor'),
Button::make('edit')->editor('editor'),
Button::make('remove')->editor('editor'),
Button::make('export'),
Button::make('print'),
Button::make('reset'),
Button::make('reload')
)
->editor(
Editor::make()
->fields([
Fields\Text::make('name')
])
);
}
If you need to add some more data, just tell me.