0

Instead of using region.show(view), I would like to add multiple views to a region without destroying the view already present in the region. I have tried using preventDestroy: true, but it isnt working out. The region only shows the last "application".

  var fetchingApplications = App.request('application:entities');

  $.when(fetchingApplications).done(function(applications) {
    console.log(applications);

    applications.each(function(application) {

      var applicationView = new List.Application({
        model: application
      });

      App.layout.mainRegion.show(applicationView, { preventDestroy: true });


    });

I know the example look weird, because I could merely use a CollectionView. However, using a CollectionView is not what I want to do.

tolborg
  • 612
  • 4
  • 21
  • It is possible by dynamically add region to layout: http://stackoverflow.com/questions/15690683/dynamically-add-regions-to-marionette-layout – Jakub Złoczewski Oct 22 '14 at 18:28
  • Explain why you don't want to use a `CollectionView`. It is almost certainly what you want to do. – Andrew Hubbs Oct 23 '14 at 17:36
  • @AndrewHubbs: The example if not sufficient I guess. I would like to fadeIn the applications in sequence. Do you have a better idea how to solve that? – tolborg Oct 23 '14 at 22:26

1 Answers1

0

I think it should works with dynamically add region and fadeIn. You could add class or inline style with 'display: none' so it will be initially not displayed and then in view put 'onShow : function(){ this.$el.fadeIn(); }'

  • Then all "applications" would fadeIn at the same time. I would like it to happen in sequence. But I guess I could do that in onShow of the CollectionView – tolborg Oct 25 '14 at 23:53