Skip to content

Conversation

@danillobitboss
Copy link

This code create a multiple searches, used to filter different values in different columns.

Run method singleSearchable() in all columns you want filter. This create one tag for each column defined.

You can use singleSearchable(), searchable() or both

    public function columns()
    {
        return [
            Column::make("#",'id')->searchable()->sortable(),
            Column::make("Name",'first_name')->singleSearchable()->sortable(),
            Column::make("Last Name",'last_name')->singleSearchable()->searchable()->sortable(),
        ];
    }

Define thSearchClass() method if you want add a class into wrapper input filter. For example

    public function thSearchClass($attribute) {
        return "myclass";
    }

automatically the view result will be

<div class="myclass">
  <input type="text" class="form-control" wire:model="single_searchable_cols.first_name" placeholder="Name">
</div>

@danillobitboss danillobitboss changed the title Add single column filtering Add multiple columns filtering Jul 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant