2010-04-20 149 views
1

嗨,我正在使用Extjs和我已經建立了一個網格與可編輯單元格。其中一個單元格必須是一個組合框,它從生成json數據的腳本中獲取選項。網格代碼和組合框編輯器工作,但我希望對腳本的json請求在第一次後緩存,是否有可能?Extjs緩存JSON請求

我寫一些代碼,這是我在聲明網格構造的組合框柱部分:

{ 
    dataIndex:"authors_name", 
    id:"authors_name", 
    header:"Authors", 
    editable:true, 
    sortable:true, 
    editor:{ 
     xtype:"combo", 
     allowBlank:false, 
     editable:false, 
     forceSelection: true, 
     displayField: 'authors_name', 
     valueField: 'authors_id', 
     store:new Ext.data.JsonStore({ 
      proxy:new Ext.data.HttpProxy({ 
       //This is the json request to cache 
       url: 'index.php?load=authors' 
      }), 
      root: 'items', 
      fields: ['authors_name','authors_id'] 
     }) 
    } 
} 

回答

2

我已經張貼在內線論壇找到了答案,這就是如果有人解決方案感興趣:

{ 
    dataIndex:"authors_name", 
    id:"authors_name", 
    header:"Authors", 
    editable:true, 
    sortable:true, 
    editor:{ 
     xtype:"combo", 
     allowBlank:false, 
     editable:false, 
     forceSelection: true, 
     displayField: 'authors_name', 
     valueField: 'authors_id', 
     //Add mode and triggerAction properties to make it work locally 
     mode:"local", 
     triggerAction:"all", 
     store:new Ext.data.JsonStore({ 
      proxy:new Ext.data.HttpProxy({ 
       url: 'index.php?load=categories&request=data&type=getAuthors' 
      }), 
      //Use the autoload property to do the request only one time 
      autoLoad:true, 
      root: 'items', 
      fields: ['authors_name','authors_id'] 
     }) 
    } 
}