Simple Filter Widget

Hello,

I don’t like the default filtering system proposed by Grist, it’s OK for static filtering and even in this case, only AND logic is available. I needed something faster and easy to use.

So I’ve designed a simple widget to filter quickly a table.

Basically it will display each lines which match at least one word (OR logic).

Sources and full instructions are available on Github, and an example is available here.

It started as a simple filtering system, but well now there are many options like: AND, negation, exactly equals, start with, regex or column selection… Please read the README on Github for full details (english and french).

I hope you’ll enjoy it :slight_smile:

9 Likes

:clap: so usefull & productive !

1 Like

New major version:

  • Many more configurations (default logic used, default value, session management…)
  • Improved interface to clarify the logic used:

README on Github updated with all details

3 Likes

Hi @Varamil

This widget looks very good and is indeed very useful. Is it ok with you if we add this widget to the Grist Widget Gallery (in this repository), to make it available in grist-core and in docs.getgrist.com ?

1 Like

New version with important bug correction is available.

Due to a mistake, I used row ids instead of table indexes when I browse the table. Then if some row have been removed from the table, ids don’t match anymore indexes, and the filter provides wrong results.

Hi @jarek, thank you for the proposal, I would be happy if the widget can be available easily.

I think the most of bug are corrected, and the most features are implemented, so I guess we can release it. Just to know, for any future update, can I do a pull request on this repository ?

Yes, I will try to include your repository as an external module. I’ll try to do it today and inform you about progress.

@Varamil

Can you change the widget id to @varamil/widget-simplefilter in package.json ?

@jarek package.json has been updated.

1 Like

Widget is now available in our gallery, thank you @Varamil !!!

2 Likes

Hey @Varamil ! Thanks for this powerful widget :slight_smile:

I noticed two issues:

  1. buttons are not dark mode compatible:

    image

  2. there is an undesirable jump-to-top behavior when clicking on a row for the first time in a filtered list

Best!

I noticed those issues as well.

Hi @ornanovitch

Thank you for feed back. I’ll see how to manage better the dark mode.

Regarding the jump-to-top issue, I face the same issue since the beginning, but on my side I don’t see what I can do to improve it. When I’ve filtered rows on my side, then I can update Grist only using the function “setSelectedRows” that takes row ids as input. No advanced interaction, so my understanding is the issue is on Grist side, on the “setSelectedRows” function management.

1 Like

I looked a little into it and I managed to solve the problem :slight_smile:

1 Like

I found those Grist variables that could do the job automatically!

background-color: var(--grist-theme-choice-token-bg);
color: var(--grist-theme-choice-token-fg);

image

image

I’ve pushed a new version of the widget, correcting previous issues and adding new features, here is a summary:

  • Add dark mode support
  • Add numerical search in addition to literal search: =, <, >, <= and >= (see readme for all details)
  • Add prefiltering option (added to each search)
  • Resolve jump-to-start issue, thanks to @ornanovitch
  • Resolve a bug on the search type button when the saved search starts by @
  • Improve performances by a better management of the search parsing
  • Improve the search by column (@…): columns id are now not case sensitive and I’ve added partial matching
  • Improve minification process with pnpm, and from this version, all of them will be available in a sub-folder @num_version

Let me know additionnal features are required.

4 Likes

@jarek could you update the submodule on the grist-widget repo?

Hi @ornanovitch

Yes sure, will try to do it today.

Thank you the reminder!

1 Like