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

How to get the chip Object on delete / click #26

Closed
ado2000 opened this issue Jan 14, 2021 · 1 comment
Closed

How to get the chip Object on delete / click #26

ado2000 opened this issue Jan 14, 2021 · 1 comment
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@ado2000
Copy link

ado2000 commented Jan 14, 2021

Hi, at the moment when a Chip is clicked or deleted, I can get the chip label by the event.getLabe().

In my case I pass an objet to the chipField " ChipField....."
How can I get the MyObject on click / delete ?

Thanks

@javier-godoy
Copy link
Member

Hello. The component uses the label for identifying chips in the client side,

private final Map<String, T> selectedItems = new HashMap<>();

but the mapping is not exposed through public API, so, we'll need to implement a mechanism that allows retrieving an item given its value. Indeed, that's the approach in Grid's listeners:
https://github.com/vaadin/vaadin-flow-components/blob/master/vaadin-grid-flow-parent/vaadin-grid-flow/src/main/java/com/vaadin/flow/component/grid/ItemClickEvent.java#L83-L99

@javier-godoy javier-godoy added the enhancement New feature or request label Jan 14, 2021
@javier-godoy javier-godoy added this to Inbox (needs triage) in Flowing Code Addons (legacy) via automation Jan 14, 2021
@javier-godoy javier-godoy moved this from Inbox (needs triage) to To Do in Flowing Code Addons (legacy) Jan 14, 2021
@javier-godoy javier-godoy self-assigned this Jan 14, 2021
@javier-godoy javier-godoy modified the milestones: 2.2.1, 2.3.0 Jan 18, 2021
javier-godoy added a commit that referenced this issue Jan 20, 2021
Add ChipEvent as superclass of removed, created and clicked events.
Update demo in order to user the new getter.

Close #26
javier-godoy added a commit that referenced this issue Jan 27, 2021
Add ChipEvent as superclass of removed, created and clicked events.
Update demo in order to user the new getter.

Close #26
Flowing Code Addons (legacy) automation moved this from To Do to Done Jan 27, 2021
javier-godoy added a commit that referenced this issue Apr 12, 2021
javier-godoy added a commit that referenced this issue Apr 13, 2021
javier-godoy added a commit that referenced this issue Apr 13, 2021
Add tests for item created and item removed listeners.

Close #46
javier-godoy added a commit that referenced this issue Apr 28, 2021
Add tests for item created and item removed listeners.

Close #46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

No branches or pull requests

2 participants