Open vwasteels opened 8 years ago
more precisely : it seems that collections in subitems are not instanciated as ampersand-collection, they remains arrays
At a glance it appears this may be true. If you pass a bare object to children it is not converted to a model. Working example here: http://requirebin.com/?gist=a4da9d25b8c2188a5397
Possibly related to: https://github.com/AmpersandJS/ampersand-state/issues/146 and or https://github.com/AmpersandJS/ampersand-state/issues/106 ?
@wraithgar thanks for the requirebin ! please look at this one which better explains the situation with the subchild children collection : http://requirebin.com/?gist=7cf86f5461c825405ade
@latentflip :
But my example is ambigous since the key of my collection item is called "children" ;)
Hello,
Is there any update regarding this issue ?
I found a workaround last time by testing if the collection had been initialized before using it, like this : `var models = collection.models ? collection.models : collection.children;``
but I'm now stuck because since sub collections are not initialized, I don't have access to custom methods I wrote for them. It's really a mess to work with hierarchical data in this situation, I'm curious to know how people handle it ... any idea ?
thanks :)
I guess one solution would be to override the set
method to recursively instanciate sub collections , I'll try something and keep this thread updated
Hello
I am dealing with hierchical data, and trying to implement it this way :
this is working almost right, the problem is that parent and children doesn't have the same format :
It looks like children item are not completely build... Am I right ?