Question

I have multiple views for multiple collections, eg. NodeCollectionView for collection nodes, roadcollectionview for collection roads and so on. The problem is that all these views are using the same el: #data as root. They need to use the same root because every item of these collections should be inserted in this main div(#data).

The problem occurred is that if I re-render one view (because of collection change, changing the position of a collection object on screen), the element duplicates on screen, not in the collection. It's because i didn't clear the root el before, but I can't, because if i will, then just the changed collection will be shown. The others don't fire render commands of course....

Can anyone help me out on this case please?

Was it helpful?

Solution

I think there are at least two approach:

1) Remove all old items of collection from container on it's render (for example, mark them with some class or data attribute, and remove all old on render).

2) On every render clean all container and call onother's collection render.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top