These are chat archives for ractivejs/ractive

25th
Mar 2018
Norbert Haberl
@nhaberl
Mar 25 2018 07:48
Why not using the update function of decorator to keep the table in snyc?
kouts
@kouts
Mar 25 2018 09:42
@nhaberl I have tried this approach but didn't work, if you want to try it here is the fiddle: https://jsfiddle.net/2x9mhhjj/6/
Paul Maly
@PaulMaly_twitter
Mar 25 2018 10:49
It also should work. I’ll check it later
kouts
@kouts
Mar 25 2018 11:52
I don't think so @PaulMaly_twitter but you are free to try :smile:
Paul Maly
@PaulMaly_twitter
Mar 25 2018 13:04
Seems works as expected, but I believe it could work better if not to re-initialize whole table each time data changed
kouts
@kouts
Mar 25 2018 13:41
@PaulMaly_twitter that seems to work!
will test it a little bit!
so no update function needed?
Paul Maly
@PaulMaly_twitter
Mar 25 2018 14:00
It’s needed only if your init process is different than update. In you solution it’s the same
For example, if there’s the way don’t re-init table plugin each time data updated
kouts
@kouts
Mar 25 2018 14:06
At some point I have tried decorator for this before and wouldn't work, maybe it was an older version of Ractive I don't know.
(decorator without an observer)
Paul Maly
@PaulMaly_twitter
Mar 25 2018 14:16
From docs:
Any updates to the arguments will call the decorator's teardown and run the decorator function again, essentially setting up the decorator again. If an update function is provided on the return object, that will be called instead of the teardown and setup function.
I think you didn’t pass data array as argument of decorator, so Ractive wasn’t observe it