Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add multiple columns filtering #30

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

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