Extjs Ext有许多关联存储未加载
我定义了两个模型,记分卡和CaregoryWeight。记分卡有许多分类权重 当我创建一个网格并将关联存储传递给它(scoreCard.categoryWeights())时,即使项目是从RESTful服务返回的,它也不会显示任何内容 怎么了?请帮忙 下面是我的代码:Extjs Ext有许多关联存储未加载,extjs,Extjs,我定义了两个模型,记分卡和CaregoryWeight。记分卡有许多分类权重 当我创建一个网格并将关联存储传递给它(scoreCard.categoryWeights())时,即使项目是从RESTful服务返回的,它也不会显示任何内容 怎么了?请帮忙 下面是我的代码: Ext.define(ModelNames.CategoryWeight, { extend : 'Ext.data.Model', idProperty : 'id', fields : [ { name : 'id'
Ext.define(ModelNames.CategoryWeight, {
extend : 'Ext.data.Model',
idProperty : 'id',
fields : [ {
name : 'id',
type : 'int'
}, {
name : 'weight',
type : 'float'
}, {
name : 'category_id',
type : 'int'
}, {
name : 'scorecard_id',
type : 'int'
} ],
associations : [ {
type : 'belongsTo',
model : ModelNames.Category,
primaryKey : 'id',
forgientKey : 'category_id'
}, {
type : 'belongsTo',
model : ModelNames.ScoreCard,
primaryKey : 'id',
forgientKey : 'scorecard_id'
} ]});
Ext.define(ModelNames.ScoreCard, {
extend : 'Ext.data.Model',
idProperty : 'id',
fields : [ {
name : 'id',
type : 'int'
}, {
name : 'description',
type : 'string',
defaults : ''
}, {
name : 'isTemplate',
type : 'boolean',
defaults : true
}, {
name : 'isValid',
type : 'boolean',
defaults : false
} ],
associations : [ {
type : 'hasMany',
model : ModelNames.ScoreRecord,
name : 'scoreRecords',
storeConfig : {
autoLoad : true,
autoSync : true,
proxy : {
type : 'rest',
url : '/' + CONTEXT_PATH + '/RESTFul/ScoreRecord',
reader : {
type : 'json',
root : 'items'
},
writer : 'json'
}
}
}, {
type : 'hasMany',
model : ModelNames.CategoryWeight,
name : 'categoryWeights',
storeConfig : {
autoLoad : true,
autoSync : false,
proxy : {
type : 'rest',
url : '/' + CONTEXT_PATH + '/RESTFul/CategoryWeight',
reader : {
type : 'json',
root : 'items'
},
writer : 'json'
}
}
} ]});
打字错误:外键
由于答案不允许少于两个单词,我要补充的是,除了发现拼写错误外,我不知道你的代码是否有效,为什么有效或为什么无效。你将有更好的机会通过在标题中使用问题获得答案。我指出的是他的答案:他错误地键入了“foreignKey”。我认为称之为打字错误可以用两个词很好地概括它。由于系统要求输入两个以上的单词,我补充说,我不知道还有什么可能是错误的。人们肯定会想修正显而易见的问题,然后再试一次。这一额外的判决要求系统将我投入监狱。什么事情真的那么糟糕?我没有恶意,这是一个有效的答案。我想纠正评论中的拼写错误,但这个系统对此相当挑剔,。好像我想了五分钟多。如果有下一次,我将脱机撰写。