These are chat archives for ractivejs/ractive

29th
Oct 2018
fiskrens
@fiskrens
Oct 29 2018 13:44

I've noticed a "bug". Might be due to missuse and rather a problem with jQuery so I'm all ears for different solutions.
When using Ractive and jQuery, jQuery seem to save a separate DOM-document, so when I'm updating the data in a Ractive-object and an event is triggered I get the wrong element with $(e.node).
Check Codepen: https://codepen.io/fiskrens/pen/vVMyqe
Try to delete item 2 and then item 3 and you'll hopefully understand what I mean.

Are there any better way to get the node aswell as ListItem Id and/or Name?

Chris Reeves
@evs-chris
Oct 29 2018 14:55
something like this? The node is still available on the event, and the context has access to all of the data that's available at the same place in the template.
fiskrens
@fiskrens
Oct 29 2018 15:28
@evs-chris That works, yeah. Are there any shorter way of getting the list item without the splice? (I'm handling the delete/whatever with an ajax-call and then reloads the list)
I currently get the listitem with:
var item = this.get(c.get('@keypath'))
Chris Reeves
@evs-chris
Oct 29 2018 15:29
c.get() should do it
fiskrens
@fiskrens
Oct 29 2018 15:39
Cool, thanks!
Cerem Cem ASLAN
@ceremcem
Oct 29 2018 16:28
@fiskrens do you have to integrate Ractive to an existing project incrementally? or will the project built around Ractive?
fiskrens
@fiskrens
Oct 29 2018 20:55
@ceremcem I have to integrate it to an existing project, but tell me what you're thinking.
Cerem Cem ASLAN
@ceremcem
Oct 29 2018 22:41
that's what I guessed by looking your example. so you have to "communicate" with existing code/environment and there seems nothing wrong in this context.