html - how to pass argument to Marionette.CompositeView -


how pass values dynamically marionette.compositeview during run time? in java create method following

package com.test.poc;  public class samplemethod {     public int add(int a, int b) {         return + b;     }      public static void main(string[] args) {         samplemethod method = new samplemethod();         int firstvalue = 90, secondvalue = 90;         system.out.println("add : " + method.add(firstvalue, secondvalue));      } } 

the above simple java code can understand above how create , pass arguments marionette.compositeview , work on them?

best regards

at moment instanciate view, can pass whatever arguments want. pass model , collection rendered in compositeview, can pass more data if need.

 var mycompositeview = backbone.mationette.compositeview.extend({      initialize : function (options){         this.datavalue = options.datavalue1;         this.helperobject = options.helperobject;         this.usevalues();      },      usevalues: function () {        console.log(this.datavalue);      }   });   var helperobject = {       value3 : "i have value",      value4 : "i dont!"  }; /// js object literal   var mymodel = new mymodel();  var mycollection = new mycollection();  var mycompositeview = new mycompositeview({model:mymodel,                                             collection:mycollection,                                             helperobject:helperobject,                                             datavalue1:"hi there"}); 

notice im passing 4 values in @ time intanciate view, , im reading 2 of them, model , collection handled marionette, other 2 can read them in initialize function.

hope helps.


Comments