【问题标题】:How to implement a Sencha Picker如何实现煎茶选择器
【发布时间】:2012-03-06 20:14:29
【问题描述】:

请任何人都可以帮我实现 Sencha 2 KitchenSink 中所见的 Sencha Picker。 即/examples/kitchensink/#demo/overlays

我不断收到此错误...

02-15 13:41:38.879:E/Web 控制台 (285):尝试使用尚未注册的 xtype 创建组件:[object Object] at undefined:0

这是我的代码的 sn-p

MrFantastic.views.faith = new Ext.Panel({
        id:'faith',
        title:'Faith',
        scroll:'vertical',
        style:'background-color:#ffffff',
        items: [

                {
                    xtype: 'fieldset',
                    layout: {
                        align: 'stretch',
                        type: 'vbox'
                    },
                    defaults:{
                        xtype: 'radiofield',
                        flex: 1,
                        labelWidth:'85%'
                    },
                    items: [
                        {
                            label: 'Intolerable',
                            name:'mode'
                        },
                        {
                            label: 'Tolerable',
                            name:'mode'
                        },
                        {
                            label: 'Compatible',
                            name:'mode'
                        },
                        {
                            label: 'Admirable',
                            name:'mode'
                        }
                    ]
                }
            ],
            dockedItems: [
                          {
                              dock:'top',
                              cls:"faith",
                              width:'100%',
                              height:'50%'
                          },
                          {
                              html:'<div class="text_pane"><h3>faith <span>{noun} {feyth}</span>:</h3><ol><li>belief in God or in the doctrines or teachings of religion</li><li>a system of religious belief</li><li>a strong belief in a supernatural power or powers</li></ol><!--<span>If you ask almost any lady what kind of man she wants for a husband, she is likely to say to you, "I want a God fearing man." This probably because she believes that a God feating man will be more faithful and truthful.</span>--></div>'
                          },
                          {
                              xtype: 'toolbar',
                              dock: 'bottom',
                              items: [
                                  {
                                      xtype: 'button',
                                      itemId: 'Previous',
                                      ui:'back',
                                      text: 'Previous',
                                      handler: function () {
                                          MrFantastic.views.viewport.setActiveItem('mrf_home', { type: 'slide', direction: 'right' });
                                      }
                                  },
                                  {
                                      xtype: 'spacer'
                                  },
                                  {
                                      xtype:'button',
                                      text: 'Score Him',
                                      handler: function () {
                                          if(!this.picker)
                                          {
                                              this.picker = Ext.create('Ext.Picker',{
                                                  slots:[
                                                         {
                                                             name:'compat',
                                                             title:'Compatibility Score',
                                                             data:[
                                                                   {text:'Intolerable', value:1},
                                                                   {text:'Tolerable', value:2},
                                                                   {text:'Compatible', value:3},
                                                                   {text:'Intolerable', value:4}
                                                                   ]
                                                         }
                                                         ]
                                              } );
                                          }
                                          this.picker.show();
                                      }
                                  },
                                  {
                                      xtype: 'spacer'
                                  },
                                  {
                                      xtype: 'button',
                                      text: 'Next',
                                      ui:'foward',
                                      handler: function () {
                                          MrFantastic.views.viewport.setActiveItem('family', { type: 'slide', direction: 'left' });
                                      }
                                  }
                              ]
                          }
                      ]
    });

请帮助我。谢谢。

【问题讨论】:

    标签: sencha-touch


    【解决方案1】:

    将此代码放入handler: function ()

        if(!this.picker){
        this.picker = new Ext.Picker({
            slots: [
                {
                    name : 'compat',
                    title: 'Compatibility Score',
                    data : [
                        {text: 'Intolerable', value: 1},
                        {text: 'Tolerable', value: 2},
                        {text: 'Compatible', value: 3},
                        {text: 'Intolerable', value: 4}
                    ]
                }
            ]
        });
    }
        this.picker.show();
    

    【讨论】:

    • :)) 这一定是我收到的最讨人喜欢和最有趣的感谢评论。 - 不客气 :)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-06-11
    • 1970-01-01
    • 1970-01-01
    • 2023-03-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多