olifolkerd / tabulator

Interactive Tables and Data Grids for JavaScript
http://tabulator.info
MIT License
6.71k stars 818 forks source link

Combining column filters with custom filter #249

Closed alainpannetier closed 7 years ago

alainpannetier commented 7 years ago

I have a table with a number of columns, most of them have their column filter option enabled. I also have a more complex custom filter implementing finer conditions that cannot be simply done through 'like' (one criterion is a superset of another : "BSCS" contains "CS").

Here is the issue. They reset each other:

Any idea, guidance?

olifolkerd commented 7 years ago

Hey,

Thanks for getting in touch,

Could you post a copy of your Tabulator constructor so i could test with your setup.

Cheers

Oli

alainpannetier commented 7 years ago

groupby_issue_247_filter_issue_249.zip

Here is the requested tarball. You just need to unzip and load home.html in the browser. (You're also welcome to take the column chooser :) but it's below par).

alainpannetier commented 7 years ago

Updated version. Now with solution to issue 247 (with a small change in tabular.js). I'll be working on this today but from my point of view the best solution would be to have a possibility to chain filters. Each column filter would register its standard filter, and API users could also register their filter). If you want I can try to contribute this.

combine_filters_issue_249.zip.zip

alainpannetier commented 7 years ago

Actually, this is too heavy from the upward compatibility perspective. Better wrap column filters in custom filter.

alainpannetier commented 7 years ago

I managed to combine field-filtering and custom filtering through a few modifications. Here is the whole static project and a diff (I respected the tabs and the typos :) so that you have only the meaningful differences). I'm not "offended" if you don't apply the patch :) issues_247_249.solved.from.orig.repo.zip

issues_247_249.diff.zip

olifolkerd commented 7 years ago

Hey,

Thanks for the info. sorry for taking so long to get back to you, ive had a crazy busy couple of weeks at work.

Im creating the next version of Tabulator this weekend so i will review everything and get back to you.

Many Thanks

Oli

alainpannetier commented 7 years ago

I understand :) :) Same here. Nut thanks so much for tabulator. All this work is very useful.

Paraplegix commented 7 years ago

I'm also interested in custom filtering , but i would love to interface that with a header filter I don't know what exactly Alain's modifications changed exactly but looking only at the .diff it doesn't apear to do what i had in mind, even if interesting for the standardisation of filters inside tabulator

Some context : In my tables, in certain cells an id is stored (ie:58), I allow change of this id by using a <select> where the <option> value are the id, and the text is a name (ie : <option value=58>Someone</option>). I use a formatter on the cell's column to transform any id to the corresponding text for it to be totaly transparent to the user.

Sometimes it might be interesting to use Header filter for those columns, but i can't ask the user to manualy enter the id (he probably don't know it) and using the same editor for the editor could be limiting to only one value.

So could it be possible to have a "customHeaderFilter" in the column definition that would act as a "filter comparator" between the value in the "headerFilter" field and the value in the row's cell and return true or false if the row pass the filter or not?

Currently i just don't allow user to do filtering in those column, lucky for me there is no need for it for me now.

alainpannetier commented 7 years ago

Hi Paraplegix,

If I understand correctly you would like to type or select 'Someone' in the header filter and only id 58 rows would be filtered in. I did something different indeed. My filter buttons are not in the header = also because I need a 'or' condition on my filter. but basically what would be nice indeed would be to be able to customise the header filter display and resulting callback filter. I might give it a try (later :( though)

olifolkerd commented 7 years ago

Hey,

Just a quick note to let you know that there will advanced filter functionality available in the upcoming 3.0 release later in May, it will allow for applying multiple filters and treating header filters and normal filters differently

Cheers

Oli

alainpannetier commented 7 years ago

Many thanks Oliver. Can't wait. We're using Tabulator much more since we first tried it last month.

On Wed, May 3, 2017 at 12:53 AM, Oli Folkerd notifications@github.com wrote:

Hey,

Just a quick note to let you know that there will advanced filter functionality available in the upcoming 3.0 release later in May, it will allow for applying multiple filters and treating header filters and normal filters differently

Cheers

Oli

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/olifolkerd/tabulator/issues/249#issuecomment-298757761, or mute the thread https://github.com/notifications/unsubscribe-auth/ABjMQFn0jU4E4SXkRk-qnS7YCARmTNw-ks5r15e1gaJpZM4Mx969 .

olifolkerd commented 7 years ago

Hey,

You will be happy to hear that version 3.0 is now in beta release, it comes with the ability to set multiple filters, and to treat header filters and programmatic filters seperatly

Head over to http://olifolkerd.github.io/tabulator/news/ to see the latest features!

Cheers

Oli