Extjs 缓冲存储不触发多个 API/ajax 调用
Extjs Buffered store not triggering multiple API/ajax calls
我有一个缓冲存储,可以进行 ajax 调用。我将 API 定义为采用一些开始和限制,并且仅 return 该开始和限制之间的结果。但是,我在滚动时没有看到多个 API 调用以不同的开始和限制进行。相反,我只看到一个 API 调用,在这种情况下,开始为 0,限制为 10。是什么导致多个 API 调用在缓冲存储中以不同的开始和限制被触发?
我的缓冲存储如下:
Ext.define('myStore', {
extend: 'Ext.data.BufferedStore',
requires: [
'myStoremodel' // model that the store takes in
],
storeId: 'myTeststore',
model: 'myStoremodel',
remoteSort: true,
buffered: true,
leadingBufferZone: 2,
trailingBufferZone: 2,
pageSize: 10,
proxy: {
type: 'ajax',
url: "/fetch/getNameList" // the API which returns data to load,
timeout: 5 * 60 * 1000,
reader: {
rootProperty: 'data.name',
totalProperty: 'data.recordSize'
},
simpleSortMode: true
}
});
这里有什么问题?任何帮助都会很棒!
解决评论之一 - ajax 调用的结果
发送的有效载荷是:
_dc: 1647375142598
page: 1
start: 0
limit: 10
ajax呼叫响应:
{success: true, errorCode: 0, errorMsg: null,…}
data: {recordSize: 10, limit: 9,…}
name: [{id: 1234, name: "Jake_Mar142022", appId: 1, isClosed: null,…},…]
0: {id: 1234, name: "TimMar142022", appId: 1, isClosed: null,…}
1: {id: 1252, name: "RatMar142022", appId: null, isClosed: null,…}
2: {id: 1253, name: "MycahMar142022", appId: null, isClosed: null,…}
3: {id: 1238, name: "MeganMar142022", appId: null, isClosed: null,…}
4: {id: 1191, name: "MikeMar092022", appId: null, isClosed: null,…}
5: {id: 1271, name: "TomMar142022", appId: null, isClosed: null,…}
6: {id: 1211, name: "RamMar092022", appId: null, isClosed: null,…}
7: {id: 1212, name: "JustinMar092022", appId: 1, isClosed: null,…}
8: {id: 1213, name: "AnnieMar092022", appId: null, isClosed: null,…}
9: {id: 1231, name: "AnnMar142022", appId: null, isClosed: null,…}
limit: 9
recordSize: 10
errorCode: 0
errorMsg: null
success: true
您在服务器上的总数是 10,您要发送 10 件物品。
您必须发送正确的 recordSize
,您将其定义为 totalProperty
我有一个缓冲存储,可以进行 ajax 调用。我将 API 定义为采用一些开始和限制,并且仅 return 该开始和限制之间的结果。但是,我在滚动时没有看到多个 API 调用以不同的开始和限制进行。相反,我只看到一个 API 调用,在这种情况下,开始为 0,限制为 10。是什么导致多个 API 调用在缓冲存储中以不同的开始和限制被触发?
我的缓冲存储如下:
Ext.define('myStore', {
extend: 'Ext.data.BufferedStore',
requires: [
'myStoremodel' // model that the store takes in
],
storeId: 'myTeststore',
model: 'myStoremodel',
remoteSort: true,
buffered: true,
leadingBufferZone: 2,
trailingBufferZone: 2,
pageSize: 10,
proxy: {
type: 'ajax',
url: "/fetch/getNameList" // the API which returns data to load,
timeout: 5 * 60 * 1000,
reader: {
rootProperty: 'data.name',
totalProperty: 'data.recordSize'
},
simpleSortMode: true
}
});
这里有什么问题?任何帮助都会很棒!
解决评论之一 - ajax 调用的结果 发送的有效载荷是:
_dc: 1647375142598
page: 1
start: 0
limit: 10
ajax呼叫响应:
{success: true, errorCode: 0, errorMsg: null,…}
data: {recordSize: 10, limit: 9,…}
name: [{id: 1234, name: "Jake_Mar142022", appId: 1, isClosed: null,…},…]
0: {id: 1234, name: "TimMar142022", appId: 1, isClosed: null,…}
1: {id: 1252, name: "RatMar142022", appId: null, isClosed: null,…}
2: {id: 1253, name: "MycahMar142022", appId: null, isClosed: null,…}
3: {id: 1238, name: "MeganMar142022", appId: null, isClosed: null,…}
4: {id: 1191, name: "MikeMar092022", appId: null, isClosed: null,…}
5: {id: 1271, name: "TomMar142022", appId: null, isClosed: null,…}
6: {id: 1211, name: "RamMar092022", appId: null, isClosed: null,…}
7: {id: 1212, name: "JustinMar092022", appId: 1, isClosed: null,…}
8: {id: 1213, name: "AnnieMar092022", appId: null, isClosed: null,…}
9: {id: 1231, name: "AnnMar142022", appId: null, isClosed: null,…}
limit: 9
recordSize: 10
errorCode: 0
errorMsg: null
success: true
您在服务器上的总数是 10,您要发送 10 件物品。
您必须发送正确的 recordSize
,您将其定义为 totalProperty