Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline searching for grid and grid block #12049

Merged
merged 24 commits into from
Oct 25, 2023
Merged

Conversation

aptkingston
Copy link
Member

@aptkingston aptkingston commented Oct 12, 2023

Description

This PR adds inline searching to the grid and grid block. Searching is only supported on a subset of column types, which right now is string, options, longform, array, number and formula columns which are of the static type.

The search field itself is always a text field at the moment, which is the main reason searching on dates is currently unsupported. This may be improved upon in future.

The search operator used is the most sensible of the available options for a given type. For most text based columns that is currently a string operator (which is a "starts with"). For numbers we use an equal operator, and for multi-select columns we use a contains operator.

Filters can be cleared by either clearing the text field or pressing the dedicated clear icon.

Using search

Hover over a header cell, and if search is supported then the left icon will transform into a search icon:
image

Pressing the icon will transform the header into a text input and focus is, ready to type to search:
image

Typing a search value will automatically start filtering the rows in the grid. Searching is automatically performed on keystrokes (debounced by a short delay to avoid spam):
image

Blurring the field will keep the filter active and highlight the header cell with a unique background color, highlighting to the user that this column has a filter applied:
image

Multiple filters can be applied at the same time and results are those that match ALL the specified filters:
image

Addresses:

Documentation

  • I have reviewed the budibase documentatation to verify if this feature requires any changes. If changes or new docs are required I have written them.

Feature branch env

Feature Branch Link

@shogunpurple shogunpurple force-pushed the grid-inline-searching branch from 875c34d to 74cab11 Compare October 17, 2023 09:57
@shogunpurple shogunpurple deleted the grid-inline-searching branch October 17, 2023 12:38
@github-actions github-actions bot locked and limited conversation to collaborators Oct 17, 2023
@mike12345567 mike12345567 restored the grid-inline-searching branch October 17, 2023 13:09
@mike12345567 mike12345567 reopened this Oct 17, 2023
Base automatically changed from grid-all-datasources to master October 20, 2023 11:04
Copy link
Contributor

@Ghrehh Ghrehh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, small question though.

A row added while an inline search is in progress will be visible even if it doesn't match the search parameters, at least for string fields, just checking this is intentional, not sure if it being immediately hidden is preferable tbh

packages/frontend-core/src/fetch/ViewV2Fetch.js Outdated Show resolved Hide resolved
@aptkingston
Copy link
Member Author

LGTM, small question though.

A row added while an inline search is in progress will be visible even if it doesn't match the search parameters, at least for string fields, just checking this is intentional, not sure if it being immediately hidden is preferable tbh

Yea I think that's the better alternative to creating a row just to have it immediately hidden. It's sort of a middle-ground though, because if you re-sort your data or do another search then the new row will be hidden. So it's basically just visible immediately after creation until the next filter/sort gets applied.

Copy link
Contributor

@deanhannigan deanhannigan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Couple of questions:

  • Search case sensitive for MultiSelect column but not Options?
    • When searching for "fuel" in the expenses I get no results.
  • For V1 Views with a groupBy defined, the grid loads but its blank
  • Similar issue to the schema issue outlined here.
  • Parse view v1 schema to fix builder crash. #12135

@aptkingston
Copy link
Member Author

As discussed, just leaving the comments here for visibility:

Search case sensitive for MultiSelect column but not Options?

Technical restriction unfortunately due to how the fields are indexed.

For V1 Views with a groupBy defined, the grid loads but its blank

I'll attempt to support these old views by updating the ViewFetch to transform "groupBy" views into a valid schema structure.

…datasource that has a custom means of determining a datasource schema
@aptkingston
Copy link
Member Author

I've added support for old views with groupBy specified. Quick screenshot showing that working:
image

@aptkingston aptkingston enabled auto-merge October 25, 2023 12:50
@aptkingston aptkingston merged commit 91d6130 into master Oct 25, 2023
10 checks passed
@aptkingston aptkingston deleted the grid-inline-searching branch October 25, 2023 12:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants