思路大家肯定是知道的:
1 上級combo在select事件中清除下級的value
2 在每一級combo中的store,beforeload事件中去get上一級下拉菜單的選中值,以此來獲取數據
網上代碼很多,我就不重復了,只是很多兄弟沒有注意下面這一點,導致菜單出現“靈異”現象。。。
3 combo中有一項重要的Propertie ,那就是lastQuery,用來存放上一次的數據,如果你沒有把這個刪掉,那么當你重新選擇上一級菜單后,再選擇下級時就會出現一直都在loading的狀態,雖然數據是load到了,但mask卻始終不消失
也就是說,你需要在store的beforeload或combo的beforequery事件中手動去刪除lastQuery
var combo = new Ext.form.field.ComboBox({ ... queryMode: 'remote', listeners: { // delete the previous query in the beforequery event or set // combo.lastQuery = null (this will reload the store the next time it expands) beforequery: function(qe){ delete qe.combo.lastQuery; } } });
補充一下,如果store里的數據來源是local,並非是通過ajax獲取的,那不需要刪掉lastQuery,直接給store的data重新賦值即可