2014-01-30 22 views
1

我有一個將JsonStore作爲對象存儲的dijit/form/ComboBox控件。將過濾條件添加到Dojo組合框

// Prepare the datasource for combobox 
settings.JsonStore = new JsonRestStore({ target: settings.dataUrl }); 
settings.ObjectStore = new ObjectStore({ objectStore: settings.JsonStore }); 

var ComboBox = new ComboBox({ 
    id: settings.id, 
    name: settings.id, 
    value: settings.value, 
    style: { 
     width: settings.width.value + 'px', 
     display: (settings.visible) ? 'visible' : 'none' 
    }, 
    maxHeight: settings.dropHeight.value, 
    store: settings.ObjectStore, 
    searchAttr: settings.comboValue, 
    labelType: "html", 
    labelFunc: function (item, store) { 
     var labelText = '....'; 
     return labelText; 
    }, 
    onChange: function (evt) { 
    } 
} 

當我嘗試查詢組合框,下面的http請求由:

http://<settings.dataUrl>/?<settings.comboValue>?A* 
http://<settings.dataUrl>/?<settings.comboValue>?AB* 

我想知道如果我能基於另一控件的值的組合框添加過濾器。例如:

http://<settings.dataUrl>/?CustomerNo=0001&<settings.comboValue>?AB* 

我已經嘗試了以下內容,我試圖通過更改url來更改過濾器更改時存儲的組合框。但它不起作用。我試圖通過再次設置存儲值來重置存儲,並導致錯誤。

回答

1

我終於能夠通過另一個問題here得到答案。

Combobox.set('query', { 'CustomerNo' : dijit.byId('<Customer control ID>').getValue() }); 

查詢變爲:

http://<settings.dataUrl>/?CustomerNo=0001&<settings.comboValue>?AB* 
+0

感謝自應答。 – Gordon