title: Sencha Touch Tree Store 'Object has no method getRootNode'
body: <p>I am developing an Android 2.3.3 app using PhoneGap and Sencha Touch 2 ...</p>
  
  <p>I have an Login view from which i redirect to nested list view in my app ... I used an inline store for the nested list and i defined the type as 'tree' for the store ... </p>
  
  <p>The first time i am trying to load the app and when i click on Login it is giving me an error ... The error is stated below :</p>
  
  <pre><code>Uncaught TypeError: Object [object Object] has no method 'getRootNode' at file:///android_asset/www/sencha/sencha-touch-all.js:15
  </code></pre>
  
  <p>But after getting the error if i force close the app and open it again everything is working fine ...</p>
  
  <p>My code is :</p>
  
  <p>Login.js</p>
  
  <pre><code>Ext.define("DDLApp.view.Login", {
      //extent panel class
      extend: "Ext.form.Panel",
      //DOM in fieldset
      requires: "Ext.form.FieldSet",
      xtype: 'formLogin',
      id:'loginForm',
      config: {
          scrollable: 'vertical',
          id: 'login',
          items: [
              {
                  xtype: "toolbar",
                  docked: "top",
              },
              {
                  xtype: "toolbar", //Toolbar with heading as login
                  docked: "top",
                  title: "Login",
                  ui:'light',
                  id:"idHeaderTwo",
                  cls:"clsLoginHeader"                
              }, 
              {
                  xtype: 'textfield', //textfield for username
                  name: 'Username',
                  required: true,
                  id:"idUserName",
                  cls:"clsUserName",
                  useClearIcon: false
             },
              {
                  xtype: 'passwordfield', //textfield for password
                  name: 'password',
                  required: true,
                  id:"idPassword",
                  cls:"clsPassword",
                  useClearIcon: false
              },
              {
                  xtype: 'button', //Login button
                  text: 'Login',
                  ui: 'confirm',
                  cls:'btnLogin',
                  width:'30%',
                  handler: function(SuccessFlag) { //Login button handler
                      ui: 'confirm',
                      console.log('Login Button pressed');
                      var form = Ext.getCmp('login');
  
                      //get username and password from form elements
                      var user = form.getValues().Username;
                      var pwd = form.getValues().password;
  
                      var msg = new Ext.MessageBox();
  
                      onLoad();
  
                      if(user == "" || pwd == "")
                      {
                          var errMsg = '';
                          if(user == "")
                              {
                                  errMsg+= 'Username is required&lt;br/&gt;';
                              }
                          if(pwd == "")
                              {
                                  errMsg+= 'Password is required';
                              }
                          msg.show({
                              title: 'LOGIN ERROR',
                              message: errMsg,
                              ui:'light',
                              cls: 'vm_error',
                              showAnimation: 'fadeIn',
                              hideAnimation: 'fadeOut',
                              buttons: [{text:'OK',itemId:'ok'}],
                              fn:function(){
                                  Ext.emptyFn();
                              }
                          });
                      }                  
                      else 
                      {
                          form.setMasked({
                              xtype:'loadmask',
                              message:'Loading...'
                          });
  
                          //Check for network connectivity
                          if(onDeviceReady())
                          {
                          //Fire a json service
                          Ext.util.JSONP.request({
                              url: DDLApp.app.oneTimeServiceUrl,
                              dataType: "jsonp",
                              params: {
                                  type:'fetch',
                                  username:user,
                                  password:pwd
                              },
                              success: function (result) {
                                //if username and password matches
                                  if(result.Success == true)
                                  {                                                
                                       //setLocalStorage(result);
                                       localStorage.setItem('userName',user);
                                       localStorage.setItem('userPassword',pwd);
                                       localStorage.setItem('totalData',JSON.stringify(result.Data));
                                       localStorage.setItem('userData',JSON.stringify(result.Data.user));
                                       localStorage.setItem('userIncidentData',JSON.stringify(result.Data.incidentList));
                                       localStorage.setItem('impactData',JSON.stringify(result.Data.impact));
                                       localStorage.setItem('incidentTypeData',JSON.stringify(result.Data.incident_type));
                                       localStorage.setItem('categoryData',JSON.stringify(result.Data.category));
                                       localStorage.setItem('statusData',JSON.stringify(result.Data.statusDropdown));
  
                                       var indexPanel = Ext.create('DDLApp.view.Main');
                                       Ext.Viewport.add(indexPanel);
                                       Ext.Viewport.setActiveItem(indexPanel,{type: 'slide', direction: 'right'});
                                       form.unmask();
                                  }
                                  else{
                                      msg.show({
                                          title: 'LOGIN ERROR',
                                          message: 'Invalid Username/Password',
                                          ui:'light',
                                          cls: 'vm_error',
                                          showAnimation: 'fadeIn',
                                          hideAnimation: 'fadeOut',
                                          buttons: [{text:'OK',itemId:'ok'}],
                                          fn:function(){
                                              Ext.emptyFn();
                                          }
                                      });
                                      form.unmask();
                                  }
                              }
                          });
                          }
                          ////If network is not present
                          else
                          {
                              form.unmask();
                              msg.show({
                                  title: 'NETWORK CONNECTION ERROR',
                                  message: "We're Sorry but it appears your device is not connected to the internet . Please check your internet settings and try again.",
                                  ui:'light',
                                  cls: 'vm_error',
                                  showAnimation: 'fadeIn',
                                  hideAnimation: 'fadeOut',
                                  buttons: [{text:'Retry',itemId:'retry'}],
                                  fn:function(){
                                      window.location.reload();
                                  }
                              });
                          }
                      }
                  },
              },
              {
                  xtype: 'button', //clear button
                  text: 'Clear',
                  width:'30%',
                  ui: 'confirm',
                  cls:'btnClear',
                  style: 'background:#4A4245;',
                  handler: function() {
                      this.up('formpanel').reset(); //reset all form elements
                  },
              }
          ]
      },
  });
  </code></pre>
  
  <p>IncidentsList.js</p>
  
  <pre><code>Ext.define("DDLApp.view.IncidentsList", {
      extend: "Ext.Container",
      xtype: 'incidentsList',
      id: 'idIncList',
      requires:[
                'Ext.dataview.NestedList',
                'Ext.data.proxy.Memory',
                'Ext.data.TreeStore',
            ],
      alias:'widget.incidentslist',
      config: {
          id: 'idIncidentList',
          layout:'fit',
          items: [
                  {
                      xtype: "toolbar",
                      docked: "top",
                      cls:'clsDDLHeader',
                      items: [
                              {xtype:'spacer'},
                              {   xtype: 'title' ,
                                  cls: 'clsRightTitle',
                                  id: 'idIncidentsListTitle',
                                  title:"Welcome",
                              },
                              ]
                  },
                  {
                      xtype: "toolbar",
                      ui:'light',
                      id:"idHeaderTwo",
                      cls:"clsHeaderTwo" ,
                          items: [
                                  {   xtype: 'title' ,
                                      cls: 'clsLeftTitle',
                                      title: "My Incidents",
                                  },
                                  {xtype:'spacer'}
                                  ]
                  },
                  {
                      xtype: 'nestedlist',
                      id:'idIncidentList',
                      onItemDisclosure:true,
                      cls:'clsNestedIncidentList',
                      toolbar:{id:'idNestedIncidentList'},
                      loadingText: "Loading Incidents...",
                      emptyText: "&lt;div class=\"empty-text\"&gt;No Incidents Found.&lt;/div&gt;",
                      getItemTextTpl: function() {
                          var tplConstructor =             
                              '&lt;tpl if="TKT_STATUS_NAME == \'CLOSED\'"&gt;'+
                              '&lt;div class="vm_statusRed"&gt;'+
                              '&lt;/tpl&gt;'+
                              '&lt;tpl if="TKT_STATUS_NAME == \'OPENED\'"&gt;'+
                              '&lt;div class="vm_statusYellow"&gt;'+
                              '&lt;/tpl&gt;'+
                              '&lt;tpl if="TKT_STATUS_NAME == \'ASSIGNED\'"&gt;'+
                              '&lt;div class="vm_statusGreen"&gt;'+
                              '&lt;/tpl&gt;'+
                              '&lt;tpl if="TKT_STATUS_NAME == \'PENDING\'"&gt;'+
                              '&lt;div class="vm_statusRed"&gt;'+
                              '&lt;/tpl&gt;'+
                              '&lt;tpl if="TKT_STATUS_NAME == \'RESOLVED\'"&gt;'+
                              '&lt;div class="vm_statusOrange"&gt;'+
                              '&lt;/tpl&gt;'+
                              '&lt;tpl if="TKT_STATUS_NAME == \'REOPEN\'"&gt;'+
                              '&lt;div class="vm_statusYellow"&gt;'+
                              '&lt;/tpl&gt;'+
                              '&lt;div class="vm_dvList"&gt;&lt;h4 class="vm_txtName"&gt;&lt;span class="vm_listHeader"&gt;&lt;label&gt;Inci.#{TKT_ID} by &lt;/label&gt;&lt;label class="vm_txtFirstName"&gt;&lt;i&gt;{FIRST_NAME:ellipsis(15, true)}&lt;/i&gt;&lt;/label&gt;&lt;/span&gt;&lt;div class="date vm_clsDate"&gt;{CREATED_ON:date("d-M-y H:i")}&lt;/div&gt;&lt;/h4&gt;'+
                              '&lt;div class="vm_title"&gt;{TKT_SUBJECT}&lt;/div&gt;'+
                              '&lt;div class="vm_subDesc"&gt;{TKT_DESC}&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;';
                          return tplConstructor;
                      },
  
                      store: {
                          type: 'tree',
  
                          fields: ['TKT_ID', 'CREATED_ON', 'FIRST_NAME', 'TKT_STATUS_NAME', 'TKT_SUBJECT', 'TKT_DESC', 'SEV_DESC', 'SERVICE_NAME', 'CATEGORY_NAME', {
                              name: 'leaf',
                              defaultValue: true
                          }],
  
                          root: {
                              leaf: false
                          },
  
                          data : localStorage.userIncidentData,
  
                          proxy: {
                              type: 'memory',
                              reader: {
                                  type: 'json',
                                  rootProperty: 'incidentList'
                              }
                          }
                      },
  
                      detailCard: {
                          xtype: "fieldset",
                          scrollable: true,
                          id: "idIncidentDetails",
                          items: [
                              {
                                  xtype: 'textfield',
                                  name: 'TKT_SUBJECT',
                                  label: 'Subject',
                                  labelAlign: 'top',
                                  cls:'vm_textFields',
                                  clearIcon:false,
                                  disabled:true
                              },
                              {
                                  xtype: 'textareafield',
                                  name: 'TKT_DESC',
                                  label: 'Description',
                                  labelAlign: 'top',
                                  cls:'vm_textFields',
                                  clearIcon:false,
                                  disabled:true
                              },
                              {
                                  xtype: 'textfield',
                                  name: 'SEV_DESC',
                                  label: 'Impact',
                                  labelWidth:'45%',
                                  cls:'vm_textFields',
                                  clearIcon:false,
                                  disabled:true
                              },
                              {
                                  xtype: 'textfield',
                                  name: 'SERVICE_NAME',
                                  id:'displayIncident',
                                  cls:'vm_textFields',
                                  label: 'IncidentType',
                                  labelWidth:'45%',
                                  disabled:true
                              },
                              {
                                  xtype: 'textfield',
                                  label: 'Category',
                                  name: 'CATEGORY_NAME',
                                  cls:'vm_textFields',
                                  id:'getCategory',
                                  labelWidth:'45%',
                                  disabled:true
                              },
                      ],
                      },
  
                      listeners: {
                          itemtap: function(nestedList, list, index, element, post) {
                              this.getDetailCard().items.items[0].setHtml(post._data.TKT_SUBJECT);
                              this.getDetailCard().items.items[1].setHtml(post._data.TKT_DESC);
                              this.getDetailCard().items.items[2].setHtml(post._data.SEV_DESC);
                              this.getDetailCard().items.items[3].setHtml(post._data.SERVICE_NAME);
                              this.getDetailCard().items.items[4].setHtml(post._data.CATEGORY_NAME);
                          }
                      }
                  }, 
                  {html:'No Incidents Found....',id:'idEmptyText'}],
      }, 
      initialize: function() {
          this.callParent(arguments);
          var incidentStore = Ext.getCmp('idIncidentList').getStore();
          Ext.getCmp("idEmptyText").hide();
          var getLoginData = localStorage.getItem('userData');
          var parseData = JSON.parse(getLoginData);
          var fname = parseData[0].FIRST_NAME;
          var getIncidentData = localStorage.getItem('userIncidentData');
          var parseIncidentData = JSON.parse(getIncidentData);
          this.down("#idIncidentsListTitle").setTitle("Welcome, " + fname);
          if(localStorage.userIncidentData != '[""]')
              {
                  Ext.getCmp("idEmptyText").hide();
                  incidentStore.setData(localStorage.userIncidentData).load();
              }
          else
              {
                  this.down("#inclist").hide();
                  this.down("#idEmptyText").show();
                  var msg = new Ext.MessageBox();
                  msg.show({
                      title: 'NO INCIDENTS FOUND',
                      message: 'No Incidents have reported by this user',
                      ui:'light',
                      cls: 'vm_error',
                      showAnimation: 'fadeIn',
                      hideAnimation: 'fadeOut',
                      buttons: [{text:'OK',itemId:'ok'}],
                      fn:function(){
                          Ext.emptyFn();
                      }
                  });
              }
      },
  });
  </code></pre>
  
  <p>I need to get rid of this error as soon as possible ... Everything in my app is working fine from the second time onwards ... I think the problem is with the store i have defined ... Please help me guys ... Thanks in Advance ...!!!</p>