2014-01-26 47 views
0

我幾乎是新的sencha觸摸,我有這個簡單的問題: 我有一個與搜索領域和開始搜索按鈕(簡單搜索)的面板:sencha觸摸點擊搜索按鈕,並加載數據視圖與AJAX搜索

items: [{ 
    xtype: 'container', 
    html: '<div style="width:100%;text-align:center;"><img src="images/logo.png" style="max-width:40%;" /></div>', 

},{ 
    xtype: 'fieldset', 
    title: '<center>Insert your adress</center>', 
    cls:'ps-red', 
    items: [{ 
     xtype: 'textfield', 
     name: 'adress', 
     required: true, 
     clearIcon: true, 
    }] 
},{ 
    xtype:'button', 
    text:'Search', 
    ui:'confirm-round', 
    margin:5, 
    handler:function(){ 
    } 
}] 

點擊搜索按鈕我需要使用輸入文本參數進行ajax調用,並將結果顯示到另一個面板。 我應該在按鈕的處理函數中寫什麼?

Ext.define('Demo.view.SearchResults', { 
    extend: 'Ext.Container', 
    xtype: 'resultcard', 
    config: { 
     layout:'fit', 
     cls:'ks-basic', 
     items: [{ 
      xtype: 'dataview', 
      scrollable: 'vertical', 
      cls:  'dataview-basic', 
      store:  '????', 
     }] 
    } 
}); 

回答

1

OK,讓我們假設商店爲「SampleStore」

這是你應該在處理函數寫的,看它是否是對你有用,在這個例子中我加推鑑於樣品通話如果你想

 handler : function(){ 
      var navigationView = button.up('navigationview'); 
      Ext.getStore('SampleStore').getProxy().setExtraParam('search',address); 
      Ext.getStore('SampleStore').load({ 
       callback: function(record, operation, success) { 
        if(success && record.length) { 
        // here you can call any other function to update panel 
        navigationView.push({ 
        xtype : 'resultcard', 
        record : record 
        }); 
        } else { 
        Ext.Msg.alert('Address not found. (' + address + ')'); 
        } 
       } 
      }); 
     }// handler close 
+0

嗨吉吉,你可以更新面板,感謝你的答案,但我已經解決了一些speding天。無論如何,你在這裏展示的setExtraParam對我來說都是需要的 – albanx