How to access a composite view from an item view instance in Backbone Marionette

后端 未结 3 1460
悲哀的现实
悲哀的现实 2021-01-30 17:47

The basic situation is this:

I have a Composite View and an Item View. I construct the Composite view passing it a model and a collection. The model data is used to popu

3条回答
  •  隐瞒了意图╮
    2021-01-30 18:19

    I didn't answer the question. But changing the approach works. Instead of trying to access the 'parent' Composite View from the Item View I access the Item View from the Composite View:

    https://github.com/marionettejs/backbone.marionette/blob/master/docs/marionette.collectionview.md#onbeforeitemadded-callback

    I can modify the model of the current item view (based on a value in the model of the Composite View).

提交回复
热议问题