logo
down
shadow

In backbone marionette is there a way to tell if a view is already shown in a region?


In backbone marionette is there a way to tell if a view is already shown in a region?

Content Index :

In backbone marionette is there a way to tell if a view is already shown in a region?
Tag : backbone.js , By : user103892
Date : November 28 2020, 01:01 AM


Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Backbone Marionette get region view


Tag : javascript , By : inquiringmind
Date : March 29 2020, 07:55 AM
it helps some times It should just be this.myRegion.currentView and model if bound to view: myRegion.currentView.model

Backbone / Marionette controller inserting view into wrong region


Tag : backbone.js , By : PepeM
Date : March 29 2020, 07:55 AM
With these it helps Solved after realizing this is from some peculiar coffeescript / Backbone / Marionette interactions...
I'm using tabs (not spaces) to indent my coffeescript, and I had:
<tab> class List.Layout extends App.Views.Layout
<space><space><tab> template: "admin/list/list_layout"
<tab> class List.Layout extends App.Views.Layout
<tab><tab> template: "admin/list/list_layout"

Backbone Marionette Region + Layout + View hierarchy and responsiveness


Tag : jquery , By : PsyberMonkey
Date : March 29 2020, 07:55 AM
With these it helps I am writing my first Marionette app and would like to use the Marionette UI structure. , I've used following structure
-Marionette Application (root - have regions hash of existing node elements)
-- LayoutView (breaks application region in sub regions if needed)

---CollectionView || CompositeView (render collections)
----ItemView
||
---LayoutView (create more sub-regions) 
---- (other sub views)
||
---ItemView (render model)
var options = {
  something: "some value",
  another: "#some-selector"
};

MyApp.start(options);
MyApp.addRegions({
  someRegion: "#some-div",
  anotherRegion: "#another-div"
});
var MyRouter = new Marionette.AppRouter({
  controller: myController,
  appRoutes: {
    "foo": "doFoo",
    "bar/:id": "doBar"
  }
});
Backbone.Marionette.LayoutView.extend({
  template: "#layout-view-template",

  regions: {
    menu: "#menu",
    content: "#content"
  }
});

Backbone/Marionette - How to listen to events on Region's child view?


Tag : javascript , By : Mario Tristan
Date : March 29 2020, 07:55 AM
wish help you to fix your issue Looks like you're using Marionette 3.x. In short, you can use childViewEvents.
As to the specifics of your code, it would be better to have the childView of your CollectionView define the click event, as the listener to the child view event will receive the childView that was clicked. It would also be better to use the showChildView method in the ParentView's onRender.
const ChildView = marionette.View.extend({
    // ...
    triggers: {
        'click .bar': 'click:bar',
    },
    // or
    events: {
        'click .bar': 'clickBar'
    },
    clickBar() {
        // other child view stuff
        this.trigger('click:bar');
    },
});
const ChildCollectionView = marionette.View.extend({
    // ...
    childView: ChildView,
    childViewEvents: {
        'click:bar': 'barClicked',
    },
    barClicked(childView) {
        // other view stuff
        this.trigger('child:clicked:bar', childView);
        // or
        this.triggerMethod('child:clicked:bar', this, childView)
    }
});
const ParentView = marionette.View.extend({
    regions: {
        foo: '.foo'
    },
    childViewEvents: {
        'child:clicked:bar': 'clickBar'
    },
    clickBar(collectionChild, clickedChild) {
        console.log('click bar', collectionChild.cid, clickedChild.model.cid);
    },
    onRender() {
        this.showChildView('foo', new ChildCollectionView());
    }
});

Correct use of Backbone listenTo from within view; Marionette region is undefined?


Tag : events , By : Priya
Date : March 29 2020, 07:55 AM
Related Posts Related QUESTIONS :
shadow
Privacy Policy - Terms - Contact Us © scrbit.com