0

だから私は以下の見解を持っています。このビューは、前のビューのリストのアイテムがタップされたときに呼び出されます。このビューのリストは前の選択に基づいてフィルター処理されますが、同じフィルター (ストア フィールド = "値") を含むこれらのリストにアイテムを追加できるようにしたいと考えています。ボタンをクリックして新しいビューをロードするときに、リストをフィルタリングしている値も渡されるようにするにはどうすればよいですか?

マイ ビュー ページ。

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 が次のビューに渡されます。

4

1 に答える 1

0

上記のコードを使用してタイトルをうまく設定できたので、送信ボタンをクリックすると、次のようにしてタイトルを取得できます。

    var titleVariable = Ext.getCmp('ShowAll')['title'];
于 2012-11-01T02:23:18.317 に答える