我们正在将应用程序从 ext js 4.2 升级到 ext js 7.7。 我们有一个模型,我们正在尝试使用该模型创建一家商店。但我们的模型出现 404 错误。相同的代码适用于 ext js 4.2,但现在在 ext js 7.7 上失败。需要帮助来解决此问题。
错误详细信息: 获取 https://9791859.app.netsuite.com/RAVI.Model.Weeks?_dc=1714733800105&page=1&start=0&limit=25 404(未找到)。
我们以相同方式创建的其他商店运行良好,但不知道为什么只有这家商店出现问题。
下面是我的模型“RAVI.Model.Weeks”,它是从模型“RAVI.Model.SimpleList”扩展而来,而“RAVI.Model.SimpleList”又是从“Ext_Ravi.data.Model”进一步扩展而来。
Ext.define("RAVI.Model.SimpleList", {
extend: "Ext.data.Model",
idProperty: "id",
fields: [
{
name: "id",
type: "int",
defaultValue: 0,
},
{
name: "name",
type: "string",
},
],
});
Ext.define("RAVI.Model.Weeks", {
extend: "RAVI.Model.SimpleList",
fields: [
// id and name already inherited
{
name: "start",
type: "string",
},
{
name: "end",
type: "string",
},
{
name: "currentWeekNumber",
type: "string",
},
{
name: "previousYearWeeks",
type: "string",
},
],
});
下面是我的商店“RAVI.Store.Pagination”,它是从“RAVI.Store.Base”扩展而来的
Ext.define("RAVI.Store.Base", {
extend: "Ext.data.Store",
autoLoad: false,
buffered: false,
constructor: function (config) {
var extraParams = !config.extraParams ? [] : config.extraParams;
if (config.url) {
Ext.apply(config, {
proxy: {
type: "ajax",
url: config.url,
reader: {
type: "json",
root: "data",
idProperty: "id",
totalProperty: "totalCount",
},
appendId: false,
extraParams: extraParams,
ownerComponentId: config.ownerComponentId,
},
});
}
this.callParent([config]);
},
});
Ext.define("RAVI.Store.Pagination", {
extend: "RAVI.Store.Base",
model: "RAVI.Model.Weeks",
listeners: {
load: function (store, records, successful, eOpts) {
var myCombo = Ext.getCmp(RAVI.App.Panel.id + "-page-combo-box");
if (myCombo) {
myCombo.triggerDataCall();
}
},
},
});
以下是我们创建商店的方式
Ext.create("RAVI.Store.Pagination", {
id: "ravi-style-trend-pl-page-combo-box",
autoLoad: true,
matchFieldWidth: false,
data: {
currentWeekNumber: "1",
end: "1/6/2024",
id: 1,
name: "Wk 1: Dec 31 - Jan 6",
previousYearWeeks: "52",
start: "12/31/2023",
},
});
请告诉我是否有人遇到过此问题以及如何解决它
在您的应用程序中,您尝试将本地数据加载到组合框。
在这种情况下,您必须将以下内容添加到组合框中:
queryMode: 'local'
否则它将尝试从服务器获取数据。由于您没有定义 URL,也没有定义
schema
,因此文件名是 usde。 => /RAVI.Model.Weeks