gpt4 book ai didi

javascript - Extjs 模型加载出现错误 "Invalid record id returned for",但仅在从全局 Controller 触发时出现

转载 作者:行者123 更新时间:2023-11-27 23:50:20 24 4
gpt4 key购买 nike

在我的 Extjs 应用程序中,我有一个模型:

Ext.define('Registration.model.SessionDetails', {
extend: 'Ext.data.Model',
fields: [
{ name: 'id', mapping: 'recid'}, // showing this field to show that an id field is being specified
...
],
proxy:{
type: 'rest',
url: 'sessions',
reader: {
type: 'json',
rootProperty: 'record'
}
}
});

当我通过除全局 Controller 之外的任何地方的代理加载此模型中的特定记录时,它会成功加载:

Example from javascript console

但是当我尝试从我的全局 Controller 中触发它时:

onSessionDetailNavigation: function (sessionsId){
// where session id is 43149 passed in from my router
var detailsWindow = Ext.widget('sessiondetails');
var model = Registration.model.SessionDetails;

var session = model.load(sessionsId, {
callback: function (){
console.log('callback fired');
}
});

...

网络调用已完成并从我的 API 返回成功:

Network call from global controller

我收到错误:

Invalid record id returned for 43149@Registration.model.SessionDetails

我认为在全局 Controller 范围内运行它不会对模型记录加载产生任何影响。我在这里缺少什么?

更新

这是尝试通过 ModelManager 获取模型的结果:

enter image description here

最佳答案

我遇到了类似的问题,在我将 ID 更改为显式设置为 int 后,它不再抛出错误。

{
name : 'id',
type : 'int',
mapping : 'recid'
}

关于javascript - Extjs 模型加载出现错误 "Invalid record id returned for",但仅在从全局 Controller 触发时出现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32769851/

24 4 0
文章推荐: html - 如果我从左到右书写,如何更改换行方向以保持旧行在顶部和新行向下突破?
文章推荐: html - Bootstrap 表格单细胞悬停
文章推荐: html - 更改