Search code examples
sproutcore

splitview not loaded from tabview menu


I created a basic page with a tabview menu. One of the tabs points to a split view. Now this split view works fine on a page reload. navigation through the different tabs works BUT the tab loading the splitview never gets displayed again, if I navigate to the splitview which does not display and then do a page reload the splitview loads fine..and if I navigate away and back the split view does not load..

I'm using the latest sproutcore.

Any one Ideas where to look?

// This page describes the main user interface for your application.  
App.mainPage = SC.Page.design({

mainPane: SC.MainPane.design({

childViews: [SC.TabView.design({
    value: "welcome",
    items: [
        { title: "Welcome", value: "welcome"},
        { title: "splitview", value: "contentView"},
    ],

    itemTitleKey: 'title',
    itemValueKey: 'value',

    userDefaultKey: "mainPane"
})]
}),

contentView: SC.SplitView.design({
  topLeftView: SC.SourceListView.create({
    contentValueKey: 'name',
    contentBinding: 'Tp.buildingBlockNodesController.content',
    selectionBinding: 'Tp.buildingBlockNodesController.selection',
  }),

  bottomRightView: SC.View.design({
      childViews: 'buildingBlockDetails'.w(),

      buildingBlockDetails: SC.View.design({
      layout: { top: 50, left: 50, bottom: 50, right: 50 },
      childViews: 'nameLabel'.w(),

      nameLabel: SC.LabelView.design({
        layout: { top: 40, width: 500, height: 18 },
        valueBinding: SC.Binding.oneWay('Tp.buildingBlockNodesController.name')
      }),
    })
  }) 
}),
welcome: SC.LabelView.design({
    escapeHTML: NO,
    value: "<h1>Sample Tankpit</h1><p>created with SproutCore</p>",
}), 
});

Solution

  • I debuged my code by running the bare minimum and at that point I renamed contentView to something else and then suddenly it worked. I should have used App.mainPage.contenView as variable name. I guess i had a name collision or something ANNOYING!

    So i changed:

    items: [
            { title: "Welcome", value: "welcome"},
            { title: "splitview", value: "contentView"},
        ],
    

    To

     items: [
                { title: "Welcome", value: "welcome"},
                { title: "splitview", value: "App.mainPage.contentView"},
            ],
    

    any other name then contenView would have worked.