-
Notifications
You must be signed in to change notification settings - Fork 26
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
Can't delegate click on child element #18
Comments
Are you configuring it using |
I am indeed using
Yeah, it makes sense why you are stopping propogation in there. Do you have any ideas on how I might be able to get around it for the time-being or am I kinda stuck? Only because the alternative I have right now is to generate the buttons outside the list completely, and reposition then over their |
Unfortunately, the only workaround that I can think of is to not delegate the clicks but rather target the specific elements and add individual event listeners. I know you said that these are being added dynamically so it'd probably have to be wired up where ever you are generating them in the first place. I'm doing some initial thinking about a complete refactor to add support for several additional types of drag-and-drop, I will keep this problem in mind as I develop it. |
Ah good call, event listeners on each button seems to do the trick. Thanks! |
No problem! |
I just thought of a quick fix for this which is to emit a custom @mrweiner thoughts?
|
Hmmmm, @schne324 that is a good idea as a quick fix, but I'd be concerned with it as a long-term solution since it would only apply to implementations that leverage handles. We aren't using handles in our implementation so we'd still need to use the event listeners on each element even with the above in place. If you could extend that so that you could pass any desired child element into the handler, that could be a more extensible solution in that you could do something like:
Instead of giving wildcard control within the hook, you could also have the user instantiate the target children as a |
Actually I just realized I may have had your intention above completely backwards, but I'll let you take a look at what I wrote and you can confirm that I misunderstood you. Haha. |
This actually wouldn't only apply to implementations using handles, if the Now that I think about it though this wouldn't help you in your situation because the desired target of the delegated event is within the item. I will keep your suggestion of adding support for a "delegated dragon click event" in which you can target a child via a selector in mind as I begin my refactor. Thanks! |
Right, yeah I guess that's what I meant in saying that it wouldn't apply where handle is Sounds good, happy to help. Thank you! |
Oh also just realized, in case it changes how you go about implementing the above, you may want/need to account for the possibility that multiple children might have the same identifier, like in the case of list items. |
I have the need to add delete buttons on each sublist element, but I cannot seem to delegate a click event on my buttons because the event is always handled by DragonDrop. The list items and delete buttons are being added dynamically. Any suggestions?
The text was updated successfully, but these errors were encountered: