1
我正在extjs + Yii中工作。我的yii的動作是:如何在extjs中綁定yii動作
public function actionCreateNew()
{
$record=Qbquestionset::model()->findAllByAttributes(array("questionPaperId"=>1));
foreach($record as $rec)
{
if($rec==NULL)
{
echo"Paper does not exists";
}
else
{
echo $rec->questionId;
$record1=Qbquestion::model()->findByAttributes(array("questionId"=>$rec->questionId));
echo "</br>". $record1->question;
echo "</br>".CJSON::encode(array("Question"=>$record1->question));
}
}
}
此函數檢索問題並以json格式發送它。 現在ExtJS的我已經創建的模型,視圖和控制器視圖= 模型= Question.js
Ext.define('Balaee.controller.Question',
{
extend:'Ext.app.Controller',
stores:['Question'],
models:['Question','QuestionOption'],
views:['question.Question','question.QuestionView'],
init:function()
{
console.log("inside Question controller");
},
});
Store.js ===
Ext.define('Balaee.store.Question', {
extend: 'Ext.data.Store',
model: 'Balaee.model.Question',
autoLoad: true,
proxy:{
type: 'ajax',
//url:'data/poll.json',
api: {
//read: 'data/question.json',
read: 'http://localhost/NewQuestion/index.php?r=QuestionBank/qbpaper/CreateNew',
},
reader: {
type: 'json',
//root: 'questions',
}
}
});
查看=== questionView.js
Ext.define('Balaee.view.question.QuestionView',
{
extend:'Ext.view.View',
id:'QuestionViewId',
alias:'widget.questionView',
store:'Question',
config:
{
tpl:'<tpl for=".">'+
'<div id="main">'+
'</br>'+
'<b>Question :-</b> {Question}</br>'+
//'<p>-------------------------------------------</p>'+
//'<tpl for="options">'+ // interrogate the kids property within the data
//'<p>  <input type="radio" name="opt" > {option}</p>'+
//'</tpl></p>'+
'</div>'+
'</tpl>',
itemSelector:'div.main',
}
});//
因此,我通過提及它的url來綁定yii動作來存儲。但商店沒有檢索任何價值。那麼在extjs存儲中檢索yii optput需要做什麼修改?