These are chat archives for ractivejs/ractive

20th
Nov 2018
Egomolch
@Egomolch
Nov 20 2018 11:47

Hi, I would need a little help with my decorator.
Scenario: I first get some suborders from the server and save them in ractive variables. After they have arrived, I get the items of each suborder from the server and save them in a ractive variable, too. Now I show tables with the items of each suborders on my page:
{{#each suborder}}
{{#if itemsOfSuborders[suborderId] && itemsOfSuborders[suborderId].length > 0}}
...

<table as-datatable="~/itemsOfSuborders[.suborderId], detailsTableOptions" class="table" id="orderDetailsTable{{suborderId}}"></table>
......

And here is the problem: my datatable decorator does not fire the update method and the table stays empty. If I throw out the if-part and only iterate over the suborders, everything works fine and the update method fires
Can anyone help me how to handle this situation?
Cerem Cem ASLAN
@ceremcem
Nov 20 2018 13:17
a simple playground example would greatly help chasing the case
kouts
@kouts
Nov 20 2018 13:21
I haven't exactly understood the problem tbh, but can you try looping a computed property instead?
Egomolch
@Egomolch
Nov 20 2018 15:19

Ok, I made a playground example. If you run it as it is, you see that the update-method of the datatable decorator does not get called. If you throw out the {{#if ...}} condition in the html, it gets called and it works as expected. I need the if-condition to not show the table (and in my real world application, to hide some other information, too) when there are no items for this suborder.

How can I add the Playground link here?

Egomolch
@Egomolch
Nov 20 2018 15:37
[Playground](https://ractive.js.org/playground/#N4IgLiBcIDwCYEsBuACBcC8AdcBDATgOYCmYOAfDAPSJLlYB2MAzgMb4IAOYamOYxALacANrgE4UYAJ6di2cMQAeYKvlyswyYhUbxk5ALLSUAZQCuAIwD2+OMXzNqteg2DAAxMQ0ALFMytbe3wAEVJcBBFmSF4lAF84vRd3dHi45wNGFGz3DwQAMxQAPyoEAUFmAHl8ixs7B2YAFWtTH2sAdwBtADoAuuCASTgAXRQAMjHi0vKqmsD6x2bWjp6+oIch4e6RYgZCMD9yFAAGBKyUGDBcSx2UXGYAWjhxF5v5HBKyoVna9cWWtpdXrzQYjAA0KHsV0iTWuO0q3AQ1gYzEkrDEzGYCiubykcOID36DmIcDxbwezDAHDkpJxOweDGsDzAcEJf0k6AUf0a+Io1D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3LzVxrsu71cnfe9kmcoNne3ELnx34kX6sl283ToqB9-p4-W+pu0w64HAcBH7gfep8yRbzgOodob8NZxBQMQQCgZ36fXPpffah1b6nSAafAUz8dgEEgcArBYDcAQIwTDAOn0yHZDiHuKhIc2zqHtEgdyVoGDEHaCgAAShoLQjCzoPwlLAmI2srhEFIJmOuGchCiGXoIjw5QpECDEXw7I091Cz3xsACerwdgxHtlPYgppVEWlrkozRMRo7AKhBEKIBcEQ0RiCQMAYRoTWPxLYocHtxGgzWAsJxVj1HGIQU9L4FRqi-AWE0AEHQzEBKgecIOe4Q6MBtMnB0KAHG+JhDY6CHt4HZDDmACOUcWw4GuoQHAt1AI4xwOyKAKAVJVJAADX6PhynWjusQBp4NWlcU6cjPYrT-yVOKSAJiAz2kNLxq0zoj1zFPRwPbVpOBgkADlrA4HEfwMoOxFkgAGOUFAqzujrPVvM0mq4RBgCZgwAQ1ydk4EejEy6szLrzJeDslZuBBA6DVCc8AWzvkxBwHsoQBzPnfI2SAew-5zAXKuTcsgtT7naglgEmZvyFmIsaYIawtoEUQq0GAbZmKACC2LcXHPTqc6FsLkTwruci-2Us7LDAmRpISZkpkthZcM3C9hla-wcGMoZ+5fa+0SQweh3DjYoTAE6HA3jggZKiOs4Uxx6pmPlSCDYcBWlqtricaaGqNRavwEMXV00EjV0YJK7Q2FZVLJmKEk1ETljtBVcANV5YWUGvLOdEZ5RVmtPqtNAAzBCB1Qhllgvefs+qKqcCfJxbc2ps04jDHiYwNUIBWBaizT4KAoB8BajEAISkWbNSQE6CAKgVBWBwAYN0YW9gRDIHwN0FhqgGCcEEFQPNYAwCcGiDW009hG0AEcdz4GkM-ZmVBBYTocNIB4Ibugrvqt0QQEFG2anVMO+tdtDT4mHB2qg67GrdHqgATjncwOdC6p0HvzkejdW7hYgHTXEIAA)
Sorry, I seem to be too stupid for that :(
Chris Reeves
@evs-chris
Nov 20 2018 16:16
if you remove the backticks from that, it will be linky 😁
Egomolch
@Egomolch
Nov 20 2018 16:23
ok, sorry, I did not recognize I made any backticks
Chris Reeves
@evs-chris
Nov 20 2018 16:36
it looks like the issue is that you're expecting the data to update, but since the render of the table is guarded by an if, it only ever gets the initial call
if you set the given data up when the decorator is initially called, it will be present in the table
I added a table.rows.add(data); table.draw(); before the return, and I think it produced the results you're looking for
Egomolch
@Egomolch
Nov 20 2018 16:45
That easy :) It works perfect now. Thank you very much for your help!
Chris Reeves
@evs-chris
Nov 20 2018 16:46
you're welcome!