sencha touch加载数据加载

时间:2011-11-21 09:12:40

标签: sencha-touch extjs javascript-framework

控制器功能

 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(){}
}

1 个答案:

答案 0 :(得分:0)

当你扩展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);

请注意,您必须在实际字段中替换,并且您可能需要稍微自定义表单。