I apologize if my question was unclear. Let me explain the issue I am facing.
I am currently working on implementing a search functionality in a table, where users can search in specific columns.
Currently, I am manually checking which checkboxes are selected and then executing the appropriate search function based on that.
However, I would like to make this process dynamic so that I don't have to modify the code every time a new column is added to the table. This is where I'm encountering difficulties.
Here is the code snippet I am using:
vm.$watch('searchTerm', function (searchTerm) {
// Code logic here
});
I attempted to use a loop for creating a more efficient solution, but I am struggling to return the functions within the loop. Adding a return statement before the loop didn't help either.
vm.$watch('searchTerm', function (searchTerm) {
// Updated code logic with loop
});
This might be a simple issue for some of you, so I apologize if I am missing something obvious. I have been stuck on this problem for the past 2 hours...
EDIT: I want to clarify the function mentioned in the code:
const contains = (value, searchTerm) => {
// Contains function logic
}
2nd EDIT: After receiving feedback from a member, I realized that even the initial version of the code is not functioning as intended. There is an option for multiple selection, so if the first two checkboxes are selected, the search should be performed in both columns simultaneously.