weixin_33681778 2010-04-20 09:42 采纳率: 0%
浏览 48

Extjs缓存JSON请求

Hi i'm using Extjs and i have built a grid with editable cells. One of this cells must be a combobox that takes its options from a script that generates the json data. The code for the grid and for the combobox-cell-editor works but i want that the json request to the script is cached after the first time, is it possible?

I write some code, this is the part where i declare the combobox column in the grid constructor:

{
    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']
        })
    }
}
  • 写回答

1条回答 默认 最新

  • weixin_33693070 2010-04-20 10:52
    关注

    I've found the answer by posting on the ext forum, this is the solution if somebody is interested:

    {
        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']
            })
        }
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘