How to visualize a view using magic

I use Backbone.Marionette and should reflect the views of employees and their respective departments. I want it to look something like this:


Department 1
***

Employee1

Employee2

Employee3


Department 2
***
Employee4

Employee5

Employee6

Employee7

Employee8



Department 3
***
Employee9

Employee10

My collection is as follows:


Employee1 / Department1

Employee2 / Department1

Employee3 / Department1

Employee4 / Department2

Employee5 / Department2


etc.

When changing, departmentI need to display the title department.

What combination of view types would I use. Collection view, Composite view. Do I need to introduce logic into the view / template?

0
source share
1 answer

The end result can be easily broken down to determine which types of types to use.

You have a collection of departments that you want to display. A CollectionViewwill handle this, allowing each department to be represented on it.

. ( ) - . -... CompositeView.

. , ItemView .

:


CollectionView
  - CompositeView (department)
    - ItemView (employee)

... , , , , , . /, , / JSON, , .

+2

All Articles