2012-04-27 39 views
0

我有一個下拉列表作爲過濾器一堆頁面。假設我有租用過濾器:類型(公寓,房屋等),靠近(海洋,山,河,火車,摩天大樓......),城市(紐約,洛杉磯,邁阿密,芝加哥等)。 ..)等... 和每個篩選器回發並重新計算其他篩選器。例如,如果選擇:靠近山脈,並看到邁阿密沒有山,所以邁阿密和其他城市不會在城市過濾器...迄今如此...ExtJS窗體:鏈接的Comboxes

我只是插入此頁作爲iFrame在其他頁面......但真的很難看。 想要使用一些ExtJs對象來幫助我。 有很多網格面板的例子,但沒有像這樣...請給我一些建議或例子,這將是很好的。謝謝。


更多詳細信息:

我找到了下手:http://examples.ext.net/#/Form/ComboBox/Ajax_Linked_Combos/ 或版本1:http://examples1.ext.net/#/Form/ComboBox/Ajax_Linked_Combos/ 這是一個很好的例子。但在將代碼移動到自己的自定義用戶控件後,該請求會觸及主頁的on-Load方法以及頁面的用戶控件和其他生命週期方法,而不僅僅是方法CitiesRefresh()。 ..我不想這種行爲,所以我用代替<ext:HttpProxy Url="mypage.aspx" Method="POST" /> ...

但我沒有選定的值,如何發送這些?也許使用ExtraParams但我不確定。

另一件事,它是多個下拉菜單。所以我想我可以響應與ddltarget項目清單......像:

data.Add(new { Id = id, Name = name, dllTarget= "Cities" }); 

<Fields> 
    <ext:RecordField Name="id" Type="String" Mapping="Id" /> 
    <ext:RecordField Name="name" Type="String" Mapping="Name" /> 
    <ext:RecordField Name="ddlTarget" Type="String" Mapping="ddlTarget" /> 
</Fields> 

但如何讀取???當「城市」設置爲它時,使用ddlTarget。

<Load Handler="#{Cities}.setValue(#{Cities}.store.getAt(0).get('id'));" /> // doesn't care ddlTarget 

回答

0

需要爲每個Combobox和1個全局存儲創建一個存儲,以便使用Json進行POST調用和檢索數據。我檢索是一組集合值的數據:是這樣的:

class dataJson{ 
    public List<ItemClass> CollectionType {get; set;} 
    public List<ItemClass> CollectionNearBy {get; set;} 
    public List<ItemClass> CollectionCity {get; set;} 
} 

當數據回來剛剛更新組合框的商店如requried:(負載是全局存儲的聽衆)

<Load Handler=" #{TypeComboBox}.clearValue(); 
#{TypeComboBox}.loadData(this.reader.jsonData); 
#{NearByComboBox}.clearValue(); 
#{NearByComboBox}.loadData(this.reader.jsonData); 
#{CityComboBox}.clearValue(); 
#{CityComboBox}.loadData(this.reader.jsonData);" /> 

每個組合框應由Rootext:Store>Reader屬性過濾數據,比如NearByComboBox storeRoot"CollectionNearBy"

+0

這裏發送參數信息:http://stackoverflow.com/questions/10386101/extjs-set-parameters-values/10433870#10433870 – Jaider 2012-05-04 15:45:42