Skip to content
This repository has been archived by the owner on Mar 27, 2023. It is now read-only.

Datagrid Custom Filters - How to set focus on open? #5976

Answered by Jinnie
mrmokwa asked this question in Q&A
Discussion options

You must be logged in to vote

Something like this should do:
https://stackblitz.com/edit/clarity-custom-filter-focus-sample?file=src%2Fapp%2Fapp.component.html

Steps:

  1. Add focus method on the filter component that sets the focus where you want it
  2. Create a <clr-dg-filter (clrDgFilterOpenChange)=... handler in the app template to wire the filter and the open/close event.
  3. Create a function in the app component that checks the open event value and calls the focus method on the component, with a short debounce.

(N.B. had to downgrade the angular version for my copy of the demo, as we have some stackblitz issues with the library versioning in V5)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mrmokwa
Comment options

Answer selected by mrmokwa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants