Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
LayerList Controller Initialize is where all the orchestration happens because we never change the collections at runtime.
//Controller for the LayerList Module
var Controller = Backbone.Marionette.Controller.extend({
initialize: function (options) {
this.region = options.region;
//The layer list has two collections
// 1) the list of basemaps
// 2) list of operational layers
this.basemapCollection = new LayerCollection(options.mapConfig.basemaps);
this.layerCollection = new LayerCollection(options.mapConfig.operationalLayers);
//create the views - these are Marionette.CollectionViews that render ItemViews
this.basemapView = new BasemapListView({collection:this.basemapCollection});
this.layersView = new LayerListView({collection:this.layerCollection});
//create our layout that will hold the child views
this.layout = new LayerListLayoutView();
//We have to render the layout before we can
//call show() on the layout's regions;;;
//hook up App events to show/hide the panel
Viewer.vent.on('View:LayerList', function (name) {
console.log('LayerListController caught View:LayerList');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.