gpt4 book ai didi

extjs - 无限滚动不渲染

转载 作者:行者123 更新时间:2023-12-01 04:02:43 26 4
gpt4 key购买 nike

我正在尝试使用 ExtJS4.1 无限滚动功能。
正在进行 ajax 调用,返回数据,但仅加载第一页。
我究竟做错了什么?当我向下滚动时,没有任何 react 。

我的代码:
店铺:

Ext.define('BM.store.Tests', {
extend: 'Ext.data.Store',
model: 'BM.model.Test',

storeId: 'Tests',
buffered: true,
leadingBufferZone: 50,
pageSize: 25,
purgePageCount: 0,
autoLoad: true
});

代理在模型中:
proxy: {
type: 'ajax',
api: {
create: '../webapp/tests/create',
read: '../webapp/tests',
update: '../webapp/tests/update'
},
reader: {
type: 'json',
root: 'tests',
successProperty: 'success'
}
}

网格:
Ext.define('BM.view.test.MacroList', {
extend: 'Ext.grid.Panel',
alias:'widget.macro-test-list',

store: 'Tests',

// loadMask: true,
// selModel: {
// pruneRemoved: false
// },
// viewConfig: {
// trackOver: false
// },

verticalScroller: {
numFromEdge: 5,
trailingBufferZone: 10,
leadingBufferZone: 20
},

initComponent: function() {

this.columns = [
{
xtype: 'gridcolumn',
dataIndex: 'name',
text: 'Name'
},
{
xtype: 'datecolumn',
dataIndex: 'created',
text: 'Date Created',
format: 'd-M-Y'
},
{
xtype: 'datecolumn',
dataIndex: 'changed',
text: 'Last Updated',
format: 'd-M-Y'
}
];
this.callParent(arguments);
}

我的实现与示例中的实现之间唯一不同的是我的网格没有渲染到正文。
视口(viewport)包含一个边框布局。
网格是西部区域面板的一部分:
{
collapsible: true,
region: 'west',
xtype: 'macro',
width: 500
}

宏面板:
Ext.define('BM.view.Macro', {
extend: 'Ext.panel.Panel',
alias: 'widget.macro',

title: 'Tests',

layout: {
type: 'vbox',
align: 'stretch'
},
items: [
{
id: "macro-test-list-id",
xtype: 'macro-test-list',
flex: 1
},
{
id: "macro-report-panel-id",
xtype: 'macro-report-list',
title: false,
flex: 1
},
{
id: "macro-report-list-id-all",
xtype: 'macro-report-list-all',
flex: 1,
hidden: true,
layout: 'anchor'
}
]
});

我已经尝试了很多东西,改变布局,给网格一个固定的高度,等等......
没有任何效果,向下滚动,网格不会刷新。
另一条信息:数据库包含 53 条数据记录。我收到了 3 个 ajax 调用,但只出现了前 25 条记录(如我要求的那样)。
有什么想法吗?

最佳答案

听起来您可能忘记输入 total服务器的 JSON 响应中的属性。你的答案是否有这样的结构:

{
"total": 53,
"tests": [(...)]
}
totalProperty名称在阅读器配置中定义,默认为 total .

http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.reader.Reader-cfg-totalProperty

关于extjs - 无限滚动不渲染,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12367669/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com