将应用程序上载到服务器时,关联在extjs4中不起作用?
我在ExtJS4MVC工作。我一直在处理关联。当我在系统本地端使用关联时,关联工作正常。但当我将其上载到服务器端时,关联数据不会显示。我尝试了很多次,但没有得到冲突发生的答案。 我的应用程序在客户端正常工作。它也显示相关数据。但当我将数据上载到服务器端时,它不会显示相关数据 以下是我的应用程序在本地工作的部分:- 但是当我将我的端上传到服务器端时,这些选项意味着关联的数据不显示 以下是我的一些代码:- 1模型类:-将应用程序上载到服务器时,关联在extjs4中不起作用?,extjs,extjs4,associations,extjs4.1,extjs-mvc,Extjs,Extjs4,Associations,Extjs4.1,Extjs Mvc,我在ExtJS4MVC工作。我一直在处理关联。当我在系统本地端使用关联时,关联工作正常。但当我将其上载到服务器端时,关联数据不会显示。我尝试了很多次,但没有得到冲突发生的答案。 我的应用程序在客户端正常工作。它也显示相关数据。但当我将数据上载到服务器端时,它不会显示相关数据 以下是我的应用程序在本地工作的部分:- 但是当我将我的端上传到服务器端时,这些选项意味着关联的数据不显示 以下是我的一些代码:- 1模型类:- Ext.define('B.model.kp.PollModel',{
Ext.define('B.model.kp.PollModel',{
extend: 'Ext.data.Model',
idproperty:'',//fields property first position pk.
fields: ['pollId','pollQuestion','isActive','pollTypeId','createDate','userId','publishDate','isPublished','approvalUserId','percentagevotes','optionId'],
hasMany:{
model:'B.model.kp.PolloptionModel',
foreignKey:'pollId',
name:'options',
},
proxy:
{
type:'ajax',
api:
{
read:'index.php/KnowledgePortal/Poll/GetPublicPoll',
create:'index.php/KnowledgePortal/Pollvote/setPollVote',
},//End of api
reader:
{
type:'json',
root: 'polls',
//successProperty: ,
},//End of reader
writer:
{
type:'json',
root: 'records',
//successProperty: ,
},
}//End of proxy
});
Ext.define('B.model.kp.PolloptionModel',{
extend: 'Ext.data.Model',
//idproperty:'',//fields property first position pk.
fields: ['optionId','option','pollId','percentagevotes'],
associations:[
{type:'HasMany', model:'Pollvotemodel', foreignKey:'optionId'},
{type:'BelongsTo', model:'PollModel', foreignKey:'pollId'},
]
});
2商店类别:-
Ext.define('B.store.kp.PollStore',{
extend: 'Ext.data.Store',
model: 'B.model.kp.PollModel',
autoLoad: true,
});//End of store
3视图类:-
Ext.define('B.view.kp.poll.PollView',{
extend:'Ext.view.View',
id:'pollViewId',
alias:'widget.PollView',
store:'kp.PollStore',
config:
{
tpl:'<tpl for=".">'+
'<div id="main">'+
'</br>'+
'<b>Question :-</b> {pollQuestion}</br>'+
'<tpl for="options">'+
'<p>{#}.<input type="radio" name="{parent.pollId}" value="{optionId}"> {option}</p>'+
'</tpl></p>'+
'</div>'+
'</tpl>',
itemSelector:'div.main',
},
});// End of login class
这里是json文件-
{
'polls': [
{
"pollId": 1,
"pollQuestion": 'Who will win the match',
"options": [
{
"optionId":1,
"option":'India',
"pollId":1
},
{
"optionId": 2,
"option": 'Pakistan',
"pollId":1
},
{
"optionId": 3,
"option": 'Srilanka',
"pollId":1
},
{
"optionId": 4,
"option": 'Australia',
"pollId":1
},
],
}
]
}
6.选项型号类别:-
Ext.define('B.model.kp.PollModel',{
extend: 'Ext.data.Model',
idproperty:'',//fields property first position pk.
fields: ['pollId','pollQuestion','isActive','pollTypeId','createDate','userId','publishDate','isPublished','approvalUserId','percentagevotes','optionId'],
hasMany:{
model:'B.model.kp.PolloptionModel',
foreignKey:'pollId',
name:'options',
},
proxy:
{
type:'ajax',
api:
{
read:'index.php/KnowledgePortal/Poll/GetPublicPoll',
create:'index.php/KnowledgePortal/Pollvote/setPollVote',
},//End of api
reader:
{
type:'json',
root: 'polls',
//successProperty: ,
},//End of reader
writer:
{
type:'json',
root: 'records',
//successProperty: ,
},
}//End of proxy
});
Ext.define('B.model.kp.PolloptionModel',{
extend: 'Ext.data.Model',
//idproperty:'',//fields property first position pk.
fields: ['optionId','option','pollId','percentagevotes'],
associations:[
{type:'HasMany', model:'Pollvotemodel', foreignKey:'optionId'},
{type:'BelongsTo', model:'PollModel', foreignKey:'pollId'},
]
});
请有人给我一些建议来解决这个问题…您确定您的服务器端数据源与本地数据源完全相同吗
相关问题是否已输入实时数据库 我得到了它的解决方案。由于错误,我没有在控制器文件中包含关联的模型类,这就是为什么会出现此问题…但我仍然对它在本地如何工作而不在控制器类中包含关联的模型感到困惑。。。