wenzhixin / bootstrap-table

An extended table to integration with some of the most widely used CSS frameworks. (Supports Bootstrap, Semantic UI, Bulma, Material Design, Foundation, Vue.js)
https://bootstrap-table.com/
MIT License
11.73k stars 4.44k forks source link

Filter Control with multiple inputs for the same data-field #6087

Open chsteiner opened 2 years ago

chsteiner commented 2 years ago

Description

Is there a way to achieve a filter with two or more inputs for the same column/data-field?

It works but the input fields get messed up in the process.

Example(s)

Example (think about Forename and Surname but the column you want to filter has both included): https://live.bootstrap-table.com/code/chsteiner/10891

albfan commented 2 years ago

You probably better add your own data to table and show an example of what you want to filter

I suppose is something like a name "Juan José" putting one world in each field.

I don't think there's any benefit in support such special scenario. In the opposite you should be able to code yourself following this example:

https://examples.bootstrap-table.com/index.html#options/filter-options.html#view-source

djhvscf commented 2 years ago

This is not supported at this moment. Can you elaborate more your scenario? It looks like that's an edge scenario

albfan commented 2 years ago

Looks he want to make two or more input text to combine into and and filter:

should match a field "Juan Jose", but I'm unsure if should too "Jose Juan", or should too "Juan Alberto"

In any case looks like something to code on your own, not to be supported by bootstrap table.

chsteiner commented 2 years ago

ok thanks. It's basically what datatables has natively implemented like this: https://codepen.io/VeeruDasa/pen/mdPvJYO $('.status-dropdown').on('change', function(e){ var status = $(this).val(); dataTable.column(7).search(status).draw(); }) and another input could filter the same column : $('.someother-dropdown').on('change', function(e){ var someother = $(this).val(); dataTable.column(7).search(someother).draw(); })

But that's just for your info. It's ok if you have to code it yourself with BS Tables. Just didn't know as it is so readily implemented in datatables.

albfan commented 2 years ago

I see a:

searchTerms.join('|') so looks it's not that automated.

this is related with: https://github.com/wenzhixin/bootstrap-table/issues/3298 where there's an implementation that works

see https://live.bootstrap-table.com/code/albfan/11369

and select several cities in dropdown.

I'm unsure how this should work with custom external UI for filters (probably it is an array)