【问题标题】:sencha touch loading data loadingsencha touch loading 数据加载
【发布时间】:2023-03-29 18:32:01
【问题描述】:

控制器功能

 startpage:function(a){
              var model1 = this.store.getAt(a.index);   
              App.views.start.load(model1);
              App.views.viewport.reveal('start');
            },

如何在起始页中获取加载的 model1 值 我怎样才能将参数从控制器传递到页面

App.views.start = Ext.extend(Ext.form.FormPanel, {

    initComponent: function(){}
}

【问题讨论】:

    标签: sencha-touch extjs javascript-framework


    【解决方案1】:

    当您扩展 FormPanel 时,我相信 Sencha 会预先填充您的字段。

    您的代码将类似于以下内容:

    App.views.start = Ext.extend(Ext.form.FormPanel, {
      initComponent: function(){
    
        var fields = {
          xtype: 'fieldset',
          id: 'a-form',
          title: 'A Form',
          instructions: 'Some instructions',
          defaults: {
            xtype: 'textfield',
            labelAlign: 'left',
            labelWidth: '40%'
          },
          items: [
            {
              name : 'title',
              label: 'title',
              xtype: 'textfield'
            },
            {
              name: 'email',
              label: 'email',
              xtype: 'emailfield'
            }
          ]
        };
    
        Ext.apply(this, {
          scroll: 'vertical',
          items: [ fields ]
        });
    
        App.views.start.superclass.initComponent.call(this);
      }
    }
    
    Ext.reg('App.views.start', App.views.start);
    

    请注意,您必须在实际字段中进行替换,并且您可能需要对表单进行一些自定义。

    【讨论】:

    • 感谢您的回复,实际上我已经做到了,但我无法在控制台面板中获取数据(由 model1 传递)
    • 在控制台中,您可以像这样访问数据:App.views.start.record.data - 但这不是您的问题。
    猜你喜欢
    • 2013-08-21
    • 2012-08-18
    • 1970-01-01
    • 2012-01-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-25
    • 2014-01-14
    相关资源
    最近更新 更多