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

New feature, Add column search #16

Closed
kastoras opened this issue Sep 2, 2019 · 3 comments
Closed

New feature, Add column search #16

kastoras opened this issue Sep 2, 2019 · 3 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@kastoras
Copy link
Contributor

kastoras commented Sep 2, 2019

Hello,

I have made some changes in order to search by column.

If I want the user to be able to search in some columns, I pass one more parameter to table params 'column_search'=>true for these columns. This creates an input field after the column header title.

Then I am able to use these filters in the query method by accessing them on $_GET['filter'] parameter like the example below:

        if(isset($_GET['filter'])){
            $filtersToArray = json_decode(stripslashes($_GET['filter']));
            if(is_array($filtersToArray)){
                foreach ($filtersToArray as $key => $value) {
                        $query = $query->where($value->filter, 'LIKE', '%'.$value->value.'%');
                }
            }
        }

This way, i am able to search in columns.

I can upload the code and working example to check this functionality and add it to the package if it's ok.

@kastoras kastoras changed the title Add column search New feature, Add column search Sep 2, 2019
@wimurk
Copy link
Contributor

wimurk commented Sep 2, 2019

@kastoras hi,

Yes you can create a pull request with the changes.

@wimurk wimurk added the enhancement New feature or request label Sep 2, 2019
@wimurk wimurk self-assigned this Sep 2, 2019
@wimurk wimurk pinned this issue Sep 3, 2019
@wimurk wimurk added this to the 3.0.25 milestone Sep 10, 2019
@wimurk
Copy link
Contributor

wimurk commented Sep 10, 2019

@kastoras in version 3.0.25 you can use the columns search.

@wimurk wimurk closed this as completed Sep 10, 2019
@wimurk
Copy link
Contributor

wimurk commented Sep 10, 2019

The columnSearch filters the column a bit diffrent. for example when searching in the users table and you fill in the name Foo the results require to have Foo in there column name.

Set the column search like below

[
            'name' => "name",
            "columnSearch" => true,
            "data" => "name"
 ],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants