2012-01-13 61 views

回答

0

您應該創建自定義綁定。例如:

Ext.create('Ext.Panel', { 
    renderTo: 'container', 
    initComponent: function() { 
     this.callParent(arguments); 

     this.store = Ext.create('Ext.data.Store', { 
      model: 'user', 
      proxy: { 
       callbackKey: 'callback', 
       type: 'jsonp', 
       url: 'http://localhost/data2.php', 
       reader: { 
        type: 'json', 
        root: 'user' 
       } 
      }, 
      autoLoad: true, 
      listeners: { 
       load: function() { 
        this.onload(); 
       }, 
       scope: this 
      } 
     }); 
    }, 
    onload: function() { 
     // do something with this.store.data 
    }, 
    listeners: { 
     destroy: function() { 
      delete this.store; 
     } 
    } 
});