How do you model a mixed collection - not composite

68 views
Skip to first unread message

Adam Akhtar

unread,
Apr 9, 2014, 9:49:56 AM4/9/14
to backbone-...@googlegroups.com
Heres an imaginary app for illustration sake

It lets you see a persons friends. You can click on Adam to see his friends, then on Bob to see his , etc etc etc 

How would you model this given

I need an index of people to start with
the collection of results can contain duplicates (see col 2 and 5 in the picture above)

It seems I need some type of hybrid collection which can hold multiple model types (a search index model and people models) and contain duplicate models but treat any events their views trigger as separate.

Backbone collections dont allow duplicate models, nor models of different type. So im a little stumped. 

Can anyone advise how one would model this scenario?

I was thinking perhaps create a wrapper collection of columns. Each column model would then hold either the index model or a person model. I guess that would get around the duplicate issue. 


Reply all
Reply to author
Forward
0 new messages