从控制器?sencha touch中将变量应用于按钮



所以我有以下视图。当从上一个视图上的列表中点击列表中的项目时,调用此视图。此视图上的列表是根据上一个选择过滤的,但是我希望能够将项目添加到包含相同过滤器的这些列表中(Store Field =" value")。我如何获得它,以便在单击按钮并加载新视图时也通过过滤列表的值也会传递?

我的查看页面。

Ext.define("MyApp.view.ShowAll", {
  extend: 'Ext.Container',
  requires: ['Ext.NavigationView', 'Ext.dataview.List', 'Ext.layout.HBox', 'Ext.Container'],
  xtype: 'myapp-showall',
  config: {
      layout: 'hbox',
      items: [
        {
        layout: 'fit',
      xtype: 'container',
      itemId: 'listContainer',
      flex: 1,
        items: [
         {
            xtype: 'list',
            store: 'leftStore',
            itemTpl: '{storeField}',
            emptyText: 'No values added yet'
          },
          {
            xtype: 'toolbar',
            docked: 'bottom',
            padding: '5px',
            items: [{ xtype: 'button', itemId: 'addValue', text: 'Add Values', ui: 'confirm', width:'100%' }]
          }
        ]
    },
    {
        style: "background-color: #333;",
        width: 10
    },
    {
    layout: 'fit',
      xtype: 'container',
      itemId: 'listContainerTwo',
      flex: 1,
        items: [
         {
            xtype: 'list',
            store: 'rightStore',
            itemTpl: '{storeField}',
            emptyText: 'No values added yet'
          },
          {
            xtype: 'toolbar',
            docked: 'bottom',
            padding: '5px',
            items: [{ xtype: 'button', itemId: 'addValueRight', text: 'Add Values', ui: 'confirm', width:'100%' }]
          }
        ]
    }
    ]
  }
});

这是我的控制器的一部分(设置了商店过滤器)

  showValues: function() {
    this.showValueDetails(arguments[3]);
  },
  showValueDetails: function(record) { 
    var title = "Value: "+record['data']['name'];
    var showValue = Ext.create('MyApp.view.ShowAll', { title: title });
    showValue.setRecord(record);
    var valueName = record['data']['name'];
    var leftStore = Ext.getStore("leftStore"); 
    leftStore.clearFilter();
    leftStore.filter('storeField', valueName); 
    var rightStore = Ext.getStore("rightStore"); 
    rightStore.clearFilter();
    rightStore.filter('storeField', valueName); 
    this.getMain().push(showValue);
},

它正确设置了页面标题,并也过滤了商店。我只是不确定如何传递变量,因此当单击按钮时,ValueName(来自控制器)将传递到下一个视图。

,因为我能够使用上面的代码设置标题罚款,一旦我单击"提交"按钮,请按以下内容获取标题。

    var titleVariable = Ext.getCmp('ShowAll')['title'];

最新更新