Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Extjs 设置页面大小Sencha touch_Extjs_Sencha Touch_Sencha Touch 2 - Fatal编程技术网

Extjs 设置页面大小Sencha touch

Extjs 设置页面大小Sencha touch,extjs,sencha-touch,sencha-touch-2,Extjs,Sencha Touch,Sencha Touch 2,我一直在尝试设置页面大小,以便我的应用程序运行得更快。我正在读取一个巨大的xml文件(数千行),我想使用ListPaging插件一次只加载一个“页面” 以下是我的清单: xtype : 'list', plugins: {

我一直在尝试设置页面大小,以便我的应用程序运行得更快。我正在读取一个巨大的xml文件(数千行),我想使用ListPaging插件一次只加载一个“页面”

以下是我的清单:

                                            xtype : 'list',          
                                            plugins: {
                                                xclass: 'Ext.plugin.ListPaging',
                                                autoPaging: true,
                                                loadMoreText : 'Loading more...',
                                                noMoreRecordsText : 'loaded'
                                            },
                                            store : 'mainStore',
                                            height : '100%',
                                            layout : 'fit',
                                            id: 'myList',
                                            flex : 5,
                                            itemTpl : "foo"
这是我的商店:

config: {
model : 'myApp.model.foo',
storeId: 'mainStore',
autoLoad: true,
//currentPage: 1,
//buffered: true,
pageSize: 15,

proxy : {
    type : "ajax",
    url : 'resources/images/data/fooBar.xml',
    startParam: 'offset',
    reader : {
        type : "xml",
        rootProperty : 'foo',
        record : 'bar'
    }
}

}
然而,当我运行这个程序时,我得到的只是整个列表底部的“加载更多…”文本(而不是15项),然后它只会再次加载相同的xml数据,但这次只是将其连接到整个“列表”的末尾

如何设置页面大小,使每个“页面”只显示15个左右的项目,然后当我滚动到列表底部(15个项目长)时,我会将接下来的15个项目连接到最后15个项目,使总共显示30个项目。。等等

使用Sencha Touch 2.4.1

更新: 以下是配置:

config: {
model : 'c17App.model.approaches',
storeId: 'mainStore',
autoLoad: true,
pageSize: 15,

proxy : {
    type : "ajax",
    url : 'resources/images/data/approach_all.xml',
    total:  17,
    start: 1,
    limit: 15,
    reader : {
        type : "xml",
        rootProperty : 'approaches',
        record : 'approach',
        totalProperty: 'total'//maybe needs to be a number?
    }
}

}

从您提供的场景来看,您的web服务似乎不符合Sencha的
ListPaging
插件。
pageSize
正被您在
store
config
中正确使用

config: {
    pageSize: 15,
    ......
}
您的API响应应具有以下属性以支持
ListPaging

  • total
    :此字段/属性将随API提供。根据该值,插件决定应用程序是否已到达列表的末尾

  • start
    :这是由
    标题中的插件发送的,远程代理将了解从哪个索引位置开始数据提取

  • 限制
    :这只是您的
    页面大小
    。它也由
    标题中的插件发送,远程代理将知道它应该从
    开始
    索引中获取多少数据

  • 因此,检查您的api响应是否有
    total
    start
    limit
    参数。如果存在,只需在代理中添加此读卡器:

    reader: {
        type: 'xml', // 'json' if the api is giving response in json format
        rootProperty: 'xyz', // Depends on your api response.
        totalProperty: 'total'
    }
    
    你的问题会解决的。 请随时要求任何其他澄清

    --------------------------------------编辑-----------------------------------------------


    api响应中应包含“
    total
    ”、“
    start
    ”和“
    limit
    ”以支持列表分页。您不必在代理中明确地发送它(正如您在编辑部分中发送的那样)

    您能提供完整的示例吗?你可以使用fiddle.sencha.com我刚刚添加了我的配置和你建议的更改,仍然给了我同样的东西,它只将相同的xml连接到最后。请在api响应中查看我的编辑、开始、限制和总数(或指示项目总数的任何字段)?请看编辑后的答案。