Displaying collections within collections with Backbone.Marionette -
I need to display / edit data that does not fit naturally with the built-in views, which Marianette provides an example to give me examples.
Say that I want to list / edit books, each book has an ISBN, a title and 0 or more tags. Basically, the display of information will be tabulated (each word under the tag is a separate tag and can be separately edited / deleted):
+ -------- - + - --------------- + ----------------------------- + | ISBN | Title | Tag | + ================================================== ======= + + 12345678 | My last summer vacation diary kids | + --------- + ---------------- + ---------------------- ------- + | 12354389 | Day after Novel Future | + --------- + ---------------- + ---------------------- ------- + If the book is only a tag, the composite view / item view will work very well. What I'm thinking, is to create the dynamically fields in the last cell of each row and then use the overall view / help to handle the list of tags. Perhaps it is fluctuating and there is a way to get some type of Iterator in the template.
I thought that a string populating would be about tag capturing and a list of tags for a particular book. I can do this by adding data from backend and creating a list of tags in the same data element so that I can use Composite View / Help to use it as a simple table. It offers an additional "mapping" and will be even more complicated to implement the ideas of "editing".
That is why I was just hoping to hear if people have fulfilled these types of needs and what was the attitude that works well with the Carineot.
There are several different ways you can do this, as you've already searched Are there. Each option will be better suited for specific sets of circumstances, but it is also possible that your circumstances are such that no one is the "best" way to complete your wish. If that's the case, then just pick one and go ahead. :)
Tag tag for a single value
This is what you already suggested. This will work well in situations where the number of tags is relatively small and when clicking on a specific tag, you do not need any custom action. For example, if you just assign each tag to & lt; A href = "# {tag-name}" & gt; are set as links, so you can easily easily tag it with simple array. Iterate the tag archive in the template
Basically the mapping option, instead of reducing the tag to a simple array of strings, you will repeat it instead of the tag archive As a model, and call model.get (...) to get the data you need.
If you are using a template engine such as Handlabar, it can really be easier to generate more clean results through the use of sub-templates.
I would not recommend this approach to the template underscores, however, when they're sloppy and ugly get resumed faster.
A collection of collections, use of a layout
This is a more complex option, but it is also most capable.
itemView will be an area of layout for the collection of books as a layout, and populated with another archive view to present this area to each individual tag Will be done. The advantage here is that you can have a lot of code and functionality. Your personal tag is being translated. You will have a single view example for each tag, which means that this notation and Easy to keep organized.
The drawback is that you will have a visual example for each tag, and to write more code just to set it up and running.
Composite view of the archive view
Compositive view lets you provide a cover template around the compilation, which can prove to be a benefit from the collection view.
You will need a collection view, yet this CollectionView will present a composite view because it is itemView . To render the collection of compositeview tags, itemViewContainer will specify each tag to get its own visual example. You can get rid of layout and area like this. The visual result is similar to using a collection view with the layout, but to do this, the amount of code is probably significantly reduced.
Personally, To bring or lower a simple array, or see a collection of composite scenes.
Comments
Post a Comment