backbone-relational: displaying nested relations in one modal dialog form

57 views
Skip to first unread message

Igor Tarakanov

unread,
Nov 26, 2014, 7:24:59 AM11/26/14
to backbon...@googlegroups.com
 Hi all,

Suppose I have the following models:

var ListWithTwoEntries = Backbone.RelationalModel.extend({
        relations
: [
           
{
                type
: Backbone.HasMany,
                key
: 'entry',
                relatedModel
: Entry
           
}
       
],

        schema
:{
           
entry:{ title: 'Entry', type:'List', itemType:'NestedModel', model: Entry, validators: ['required'] }
       
}
   
});


...


var Entry = Backbone.RelationalModel.extend({
        name: '',
        value: '',
       

        relations: [
           
{
                type
: Backbone.HasMany,
                key
: '
someComplexModel',
                relatedModel
:
SomeComplexModel
           
}
       
],

       
        schema
:{
            name
:{ title: 'Name', type:'Text', validators: ['required'] },
            name:{ title: 'Value', type:'Text', validators: ['required'] }
       
}
   
});

The question is: how can I create a template for backbone-forms to allow these ListWithTwoEntries be rendered in one view within its contents? I mean, without modal adapter (which comes with backbone-forms) to be applied for every list object?

Can someone please share a simple example if it's doable?

Thank you.


Reply all
Reply to author
Forward
0 new messages