title: Restore Ext panel state
body: <p>How is the state of a collapsiple panel restored in <a href="http://en.wikipedia.org/wiki/Ext_%28JavaScript_library%29" rel="nofollow">Ext</a> 4?</p>
  
  <p>I use the following, but it's not restored:</p>
  
  <pre><code>    var panel = Ext.create('Ext.panel.Panel', {
          id: 'panel',
          stateful: true,
          stateId: 'panelState',
          stateEvents: ['collapse', 'expand'],
          getState: function () {
              Console.log('get state' + this.collapsed);
              return {
  
                  collapsed: this.collapsed
              }
          },
          applyState: function (state) {
              Console.log('apply state' + this.collapsed);
              if (state) {
                  Ext.apply(this, state);
              }
          },
          saveState: function() {
              Console.log('save state' + this.collapsed);
              debugger;
              var me = this,
                  id,
                  state;
              if (me.stateful !== false) {
                  id = me.getStateId();
                  if (id) {
                      state = me.getState();
                      if (me.fireEvent('beforestatesave', me, state) !== false) {
                          Ext.state.Manager.set(id, state);
                          me.fireEvent('statesave', me, state);
                      }
                  }
              }
          },
          height: 100,
          border: false,
          style: { zIndex: 100 },
        });
  </code></pre>