Senchatouch 2 getpagebox
===

I have a panel with one of the items is of type navigationview.
I fill the store by .add without problems when a row is tapped on the list. Another page is pushed. Also going okay.
The next thing is a problem. When switching back to the first view and tap again a js error is thrown like this

Uncaught TypeError: Cannot call method 'getPageBox' of null sencha-touch-all-debug.js:33115

I read some post on senchatouch forum but without a clue to remediate.

The code:
               
      Ext.define('mvillacomfort.view.TitleBar_', {
          extend: 'Ext.TitleBar',
          xtype : 'titlebar_',
          config: {docked:'top'}
      });
      
      Ext.define('mvillacomfort.view.TopTabPanel', {
          extend: 'Ext.Panel',
          xtype: 'toptabpanel',
      
          config: {
              layout: 'fit',
      
              items: [
                  {
                      xtype: 'tabpanel',
                      tabBarPosition: 'top',
                      height: '100%',
                      width: '100%',
                      items: []
                  }
              ]
          }
      });
      
      Ext.define('mvillacomfort.view.PriceTopTabPanel', {
          extend: 'Ext.Panel',
          xtype: 'pricetoptabpanel',
      
          config: {
              layout: 'fit',
      
              items: [
                  {
                      xtype: 'tabpanel',
                      tabBarPosition: 'top',
                      height: '100%',
                      width: '100%',
                      items: []
                  }
              ]
          }
      });
      
      Ext.define( 'mvillacomfort.view.CalendarPanel', {
          extend: 'Ext.navigation.View',
          xtype: 'calendarpanel',
      
          config: {
              items: [{
                title: 'Start uw reservering met het kiezen van de startweek.',
                xtype: 'calendarlist'
              }] 
          }
      });
      
      Ext.define ( 'mvillacomfort.view.Main', {
        extend: 'Ext.tab.Panel', 		
        xtype : 'mainpanel',
      
        config: {
            fullscreen: true,
            tabBar: {
                docked: 'bottom',
                layout: {
                  pack: 'center'
                }
            },
      
            defaults: {
              scrollable: true
            },
      
            items: [
                {
                    title   : 'Home',
                    iconCls : 'home',
                    xtype   : 'toptabpanel'
                },
                {
                    title   : 'Pricetag',
                    iconCls : 'bookmarks',
                    xtype   : 'pricetoptabpanel'
                },
                {
                    title   : 'Booking',
                    iconCls : 'bookmarks',
                    xtype   : 'calendarpanel'
                },
                {
                    title: 'Villa comfort, Molieres sur Ceze',
                    iconCls: 'bookmarks',
                    xtype: 'titlebar_'
                }
            ]
        }
      });

The code in the controller:


    showendperiodbooking: function (list, record) {
      if (record) {
        //startweekkey = new clkeyunderscore ( record.get('key'), this.meta );
        omwrapper.startweeknr = record.get('weeknr');
        omwrapper.startdate = record.get('startdate');
        endperiodstore = Ext.getStore ( 'CalendarEnd' );
        if (endperiodstore) {
          omwrapper.fillendweekstore ( endperiodstore, omwrapper.startweeknr );
          omwrapper.calendarpanel.push ({
            xtype: 'calendarendlist',
            title: 'Arrival '+omwrapper.startdate  + '. Choose the end week of your reservation.'
          });
        }  
      }	
    },

The evnt handling in the controller


  Ext.define ('mvillacomfort.controller.Main', {
      extend: 'Ext.app.Controller',
  
      config: {
        refs: {
              main: 'mainpanel'
          },
          control: {
              'calendarlist': {
                  disclose: 'showendperiodbooking'
              },
              'calendarendlist':{
                pop: this.onPopped
              }  
          }
      },

The first list is also filled by a JS routine like this:

    omwrapper.fillstorecalendar ( ocalendarstore, 0, false );

Omwrapper code:

      fillstorecalendar : function ( ocalendarstore, nstartweek, lskipbookedreserved ) {
        var oweeks = this.calendar.weeks, oweek;
        var nlen = oweeks.length;
        var days, months;
        
        for (var i=nstartweek;i<nlen;i++) {
          oweek  = oweeks [i];
          days   = oweek.date.getDate ();
          months = oweek.date.getMonth () +1;
          
          if (lskipbookedreserved) {
            if (!oweek.occupied && !oweek.reserved) {
              ocalendarstore.add ( { 'weeknr':"Weeknr:" + (oweek.weeknr.toString() ) + " ",
                'startdate': "Zaterdag: "+ days.toString() + "-" + months.toString () + " " , 
                                       'price': "Prijs: "+oweek.price.toString() } ); 
            }	
          } else { // show startweek
            ocalendarstore.add ( { 'weeknr':"Weeknr:" + (oweek.weeknr.toString() ) + " ",
              'startdate': "Zaterdag: "+ days.toString() + "-" + months.toString () + " " , 
                                       'price': "Prijs: "+oweek.price.toString() + " " , 
                                       'occupied': oweek.occupied,'reserved': oweek.reserved} );
          } 
        }	
      }, 	

I hope somebody can shine a light on this nasty error

Thanks,
John






