Consider the following view structure:
- Layout View
- Map View
- List View
- Item View
- List View
- Item View
- Item View
- List View
- Item View
- List View
- Item View
- Item View
- List View
- Item View
At the moment, I have only one controller for that entire structure. All the nested views communicate with that controller by bubbling events.
Would I want to create a controller for each level? What I've got works, but I feel like my layout view and list views are doing too much - e.g. when the controller says "here is an updated list of items (from the server)", the layout view is responsible for removing map markers that are not part of the new data, update existing ones, and add new ones. At the same time, the LayoutView's first ListView is responsible for doing the exact same, but for it's items.
Would it be a better idea to create a controller for each? If so, how would I go about it? Should the layout view get a ListController and a MapController injected, which would be responsible for constructing the child views?
If the tech is of interest: This is for a JavaScript widget.