我在这里遇到了一个相当奇怪的错误/问题,我似乎无法弄清楚。
在我的网格的双击事件中,我正在向我的 Api 控制器发送一个带有 Id 的请求,以获取一个“合同”记录以加载到 ExtJs 端的表单中。.NET 调试发回包含所有字段的正确“合同”记录。
网络流量还显示记录已检索到所有字段,如下所示。
但是,在我的加载成功回调中记录记录时,我只有 ID 字段。
这意味着当将我的记录加载到我的表单中时,没有显示任何字段。
模型如下图,
Ext.define('Heating.model.contract.Contract', {
extend: 'Ext.data.Model',
fields: [
{ name: 'id', type: 'auto' },
{ name: 'organisationId', type: 'auto' },
{ name: 'organisation', type: 'auto' },
{ name: 'systemTypeId', type: 'auto' },
{ name: 'systemType', type: 'auto' },
{ name: 'description', type: 'auto' },
{ name: 'deleted', type: 'auto' },
{ name: 'startDate', type: 'date' },
{ name: 'endDate', type: 'date' },
{ name: 'lastModified', type: 'date', dateFormat: 'c' }
],
validations: [
{ type: 'presence', field: 'description'},
{ type: 'length', field: 'description', max: 255},
{ type: 'presence', field: 'organisationId'}
],
proxy: {
type: 'rest',
url: Heating.util.Config.BaseUrl + 'api/contract',
noCache: true,
filterParam: 'filter',
reader: {
type: 'json',
root: 'data',
totalProperty: 'total',
messageProperty: 'message'
},
writer: {
type: 'json'
}
}
});
和存储,
Ext.define('Heating.store.contract.Contracts', {
extend: 'Ext.data.Store',
model: 'Heating.model.contract.Contract',
storeId: 'contracts',
autoLoad: false,
remoteFilter: true,
listeners: {
load: function(store, records) {
console.log('Contract store loaded');
console.log(store.getCount());
}
}
});
有任何想法吗?提前致谢!