Skip to content

How can I run a function *exclusive* to onColumnSearch or onSearch? #7891

@hepcat72

Description

@hepcat72

Description

I want to run different javascript functions that are specific to either a whole table search or a column search, but when I try to use onSearch and onColumnSearch for that, the onSearch event gets triggered whenever an onColumnSearch is triggered. In other words, if the user enters a column search term, I don't want to run the function associated with an onSearch event, but that's what happens. I understand the thinking behind it, so I'm not saying that the behavior is wrong. I just would like to know how to distinguish the originating event - the event that triggered the search. And I can't base it on a search term change, because I want to capture the event where the user has clicked the trash can button when there is no search term in the input field associated with the table search (so that search term goes from empty string to empty string).

I was thinking that I could check all the values in the column filter inputs in an onSearch event, but I thought I would ask if there is a way to know what the originating event was (a column search or a "table search").

Example(s)

Open the console and then enter a column search term (e.g. search for '1' in the 'Item Name' column) and observe the 2 log prints. How can I run only the function associated with onColumnSearch and not subsequently run the onSearch associated function

https://live.bootstrap-table.com/code/hepcat72/18972

Metadata

Metadata

Assignees

No one assigned

    Labels

    help-wantedIssues we need or would love help from the community to resolve.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions