bootstrap-table
bootstrap-table copied to clipboard
How can I make a columns dropdown list dependent on another columns selected value?
Description
I'm using bootstrapTable and data-filter-control. And I wonder how I can make a columns dropdown list dependent on another columns selected value? An example can be found directly on the examples page https://examples.bootstrap-table.com/#extensions/filter-control.html. For example, when you enter '5' in the column "Item Name" you see only 2 items in the list. But the dropdown menu of the item price shows all prices, not just the 2 different prices of the displayed rows (which I would like).
Example(s)
https://examples.bootstrap-table.com/#extensions/filter-control.html
If you want to obtain a second select filter with values dependent on first choice in the first select filter:
apply hideUnusedSelectOptions : true
as Table Option.
Tried with 1.16 and 1.21.2.
Great! Thank you very much for your help! :-)
Unfortunately I have identified a weak point in this solution... this option hides ALL unused dropdown options, even from the first dropdown.
For example when I have a dropdown "Databases" and a drop "Tables" and I select a Database, the dropdown for Database also only shows the selected database (an empty entry), and I can no longer select another database.
Is there a possibility to do the filtering for only for specific columns?
Thank you!
I believe you must reset your filter
- Clicking on first empty entry on first filter or 2. Adding a button to reset all filters.
yes, this does work. but if there would be a column-specific possibility one would only have to select another database instead of clicking 2 times (1. clear, 2. select)
How do I turn on hideUnusedSelectOptions? Is it within the <table></table>
tags?
I have multiple dropdown filters, and each one of them has a dependency on the other filers, for example, Country, State, City, etc. If you select country, the state should be filtered by country, and if you select a state, the city dropdown should filtered by the country and the state.