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

calcite-list - changing filter-text property/attribute does not filter the list items #6633

Closed
jgrayson-apl opened this issue Mar 22, 2023 · 10 comments
Assignees
Labels
4 - verified Issues that have been released and confirmed resolved. bug Bug reports for broken functionality. Issues should include a reproduction of the bug. estimate - 5 A few days of work, definitely requires updates to tests. has workaround Issues have a workaround available in the meantime. impact - p3 - not time sensitive User set priority impact status of p3 - not time sensitive p - high Issue should be addressed in the current milestone, impacts component or core functionality refactor Issues tied to code that needs to be significantly reworked. research Issues that require more in-depth research or multiple team members to resolve or make decision.

Comments

@jgrayson-apl
Copy link

Actual Behavior

The list of calcite-list-items is not updated/changed/filtered when changing the filter-text property/attribute of the calcite-list via code.

Expected Behavior

I would expect the list of calcite-list-items to be updated/changed/filtered when changing the filter-text property/attribute of the calcite-list via code.

Reproduction Sample

https://codepen.io/john-grayson/pen/ZEMMqdX

Reproduction Steps

  1. click on the 'FILTER BANANAS' button
  2. see how the list is not filtered

Reproduction Version

1.07

Relevant Info

No response

Regression?

No response

Priority impact

p4 - not time sensitive

Impact

No response

Esri team

N/A

@jgrayson-apl jgrayson-apl added 0 - new New issues that need assignment. bug Bug reports for broken functionality. Issues should include a reproduction of the bug. needs triage Planning workflow - pending design/dev review. labels Mar 22, 2023
@github-actions github-actions bot added the impact - p3 - not time sensitive User set priority impact status of p3 - not time sensitive label Mar 22, 2023
@jgrayson-apl
Copy link
Author

Q: Any current workarounds to this issue?

I just need to change the filter via code... we should be able to do this somehow, no?

@jcfranco
Copy link
Member

@jgrayson-apl Not ideal by any means, but could you give this a try? https://codepen.io/jcfranco/pen/PoyzwKx?editors=0010

@jcfranco jcfranco added the has workaround Issues have a workaround available in the meantime. label Apr 17, 2023
@jgrayson-apl
Copy link
Author

@jcfranco yes kinda hacky but ok for a workaround, I was able to adapt the concepts to a couple of apps. Thank you very much.

@driskull
Copy link
Member

driskull commented May 2, 2023

I think this needs to be fixed in the filter component.

The filter component doesn't emit an event when the filterText changes programmatically. The issue is that when filterText is changed programmatically the filteredItems property changes after a debounce so there's no way to know when to grab that new data. The filter would either need to emit or have another event for when the filteredItems changes.

@geospatialem geospatialem added refactor Issues tied to code that needs to be significantly reworked. research Issues that require more in-depth research or multiple team members to resolve or make decision. p - high Issue should be addressed in the current milestone, impacts component or core functionality estimate - 5 A few days of work, definitely requires updates to tests. labels May 2, 2023
@geospatialem geospatialem added 1 - assigned Issues that are assigned to a sprint and a team member. and removed 0 - new New issues that need assignment. needs triage Planning workflow - pending design/dev review. labels May 2, 2023
@geospatialem geospatialem added this to the 2023 July Priorities milestone May 2, 2023
@driskull
Copy link
Member

@jcfranco what are your thoughts regarding how filter can let other components know when the filterText changes?

driskull added a commit that referenced this issue Jun 2, 2023
@driskull driskull added 2 - in development Issues that are actively being worked on. 1 - assigned Issues that are assigned to a sprint and a team member. and removed 1 - assigned Issues that are assigned to a sprint and a team member. 2 - in development Issues that are actively being worked on. labels Jun 2, 2023
@driskull
Copy link
Member

driskull commented Jun 2, 2023

@jcfranco I'd like to get this going. What do you think about...

  • Making a public filter method that would resolve once debouncing is complete.
  • Changing the calciteFilterChange event to emit on both programatic and user changes.
  • Removing debouncing from the filter and making other components handle debouncing

@jgrayson-apl
Copy link
Author

Since you guys are thinking about this issue... I would like to have the ability to set/override a 'filter' function/callback (like we can do with simple arrays) where I could perform my own more complex checks to determine if an item passes the test. There are many times when entering text in the input is not what we need. Sometimes we have multiple criteria to consider or even a simple discrete set of options that we want to filter on. Probably beyond what is going on here, but thought I'd mention anyways.

@jcfranco
Copy link
Member

jcfranco commented Jun 3, 2023

@driskull I think we could proceed with your first suggestion and introduce a filter(text) method that updates the filter text and also resolves when done. Would this still necessitate the other suggestions? I'd like to avoid them if possible.

@jgrayson-apl #3454 might cover your request.

driskull added a commit that referenced this issue Jun 5, 2023
@driskull driskull added 2 - in development Issues that are actively being worked on. and removed 1 - assigned Issues that are assigned to a sprint and a team member. labels Jun 6, 2023
driskull added a commit that referenced this issue Jun 28, 2023
**Related Issue:** #6633

## Summary

- Adds public filter method to the calcite-filter component.
- Fixes setting `filteredItems` on filter.
- Adds test
driskull added a commit that referenced this issue Jun 28, 2023
#7133)

**Related Issue:** #6633

## Summary

- Depends on #7127
- Tidy's up tests and remove skipping.
- Watches `filterText` property and calls `filter` method when it
changes.
- Calls `filter` method once the filterEl has been rendered.
- Cleanup
@driskull driskull added 3 - installed Issues that have been merged to master branch and are ready for final confirmation. and removed 2 - in development Issues that are actively being worked on. labels Jun 28, 2023
@github-actions github-actions bot assigned geospatialem and unassigned jcfranco and driskull Jun 28, 2023
@github-actions
Copy link
Contributor

Installed and assigned for verification.

@geospatialem geospatialem added 4 - verified Issues that have been released and confirmed resolved. and removed 3 - installed Issues that have been merged to master branch and are ready for final confirmation. labels Jun 29, 2023
@geospatialem
Copy link
Member

Verified in 1.5.0-next.8.

verify-list-filter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4 - verified Issues that have been released and confirmed resolved. bug Bug reports for broken functionality. Issues should include a reproduction of the bug. estimate - 5 A few days of work, definitely requires updates to tests. has workaround Issues have a workaround available in the meantime. impact - p3 - not time sensitive User set priority impact status of p3 - not time sensitive p - high Issue should be addressed in the current milestone, impacts component or core functionality refactor Issues tied to code that needs to be significantly reworked. research Issues that require more in-depth research or multiple team members to resolve or make decision.
Projects
None yet
Development

No branches or pull requests

4 participants