0

i am working in extjs+ Yii framework. I have view as- QbQns.js-

Ext.define('Balaee.view.qb.qbqns.Qbqns',    
        {
    extend:'Ext.form.Panel',
    requires:[
              'Balaee.view.qb.qbqns.QbqnsView'
              ],
              id:'qbqnsId',
              alias:'widget.Qbqns',
              title:'Qbqns',
              height:500,
              items:[
                     { xtype:'QbqnsView',},
                     ],//end of items square
                     buttons:[
                              { xtype:'button',
                                  fieldLabel:'Vote',
                                  action:'voteAction',
                                  name:'vote',
                                  formBind:true,
                                  text:'submit', } ] });

On this submit button click, i want to create new view as-

 Ext.define('Balaee.view.qb.qbqns.QbqnsReviewView',
    {
            extend:'Ext.view.View',
            id:'qbqnsViewId',
            alias:'widget.QbqnsReviewView',
            //store:'kp.PollStore',
            store:'qb.QbqnsStore',
            config:
            {
                tpl:'<tpl for=".">'+
                    '<div id="main">'+
                    '</br>'+

                    '<h1 id="q">Question :-</h1> {question}</br>'+

                 /*  '<tpl for="options">'+     // interrogate the kids property within the data
                        '<p>&nbsp&nbsp<input type="radio" name="{parent.questionId}" value="{option}">&nbsp{option}</p>'+
                    '</tpl>'+*/

                    '<tpl for="options">'+
                        '<tpl if="parent.Correctoption==option">'+
                        //'<tpl if="Correctoption==UsersOption">'+
                        '<p style="color:Green"><input type="radio" name="{optionId}">{option}</p>'+

                        '<tpl elseif="parent.UsersOption==option">'+
                        '<p style="color:Red"><input type="radio" name="{optionId}">{option}</p>'+

                        '<tpl else>'+
                        '<p><input type="radio" name="{parent.questionId}" value="{option}">&nbsp{option}</p>'+

                        '</tpl>'+  
                    '</tpl>'+   



     '<p>---------------------------------------------------------</p>'+
                    '</div>'+

                   '<h1 id="q">Total marks are:-</h1>{Total}'+
                   '<h1 id="q">Score you got is:-</h1>{Score}'+

                    '</tpl>',



                itemSelector:'div.main',
            }
    });// End of login class

So how to call this above view from controller on submit button click. Please suggest me...

4

1 回答 1

0

在您的控制器中:

init: function() {
    this.control({
        'button[action=voteAction]': {
            click: function(btn) {
                Ext.create('Balaee.view.qb.qbqns.QbqnsReviewView', {
                    renderTo: Ext.getBody();  //<-- where you want render it
                });
            }
        }
    });
}

此外,您视图中的商店现在也是一个字符串。使用 Ext.create() 或 Ext.getStore(storeId)。

你需要阅读指南吗?

于 2013-02-19T06:37:42.427 回答