DataTable Filter Based on Selection
DataTable Filter Based on Selection
Link to test case: In progress
Hello,
I have a DataTable that is filtered by an object I created called teamData. Which has every team and the members of each team. Depending on whatever the current user's name is, it searches teamData to find the team that user is in, and then displays information in that table pertinent to that user/team. Some users are on more than one team, so instead of showing both teams at once, I would like the user to be able to select a value from a dropdown above the table and whatever value they select, draws that data to the table. Is this possible?
This question has an accepted answers - jump to answer
Answers
You can use a search plugin for this. In the search plugin you can check the value of the team select list and display/hide the teams accrodingly.
Kevin
So that is what I did here, but it tells me selectedVal is not defined https://jsfiddle.net/BeerusDev/vL6fokg2/25/
First problem is you don't put event handlers inside a function that runs multiple times. In this case the event handler will be bound to the input each time the plugin runs. 50 rows equals 50 events being fired
Next you will want to get the select value in the plugin. And in the event handler just call
draw()
.https://jsfiddle.net/upxwg705/
Kevin