Ext Js注意的问题 解决combox 老是Loading的问题

来源:互联网 发布:雅思听力怎么提高 知乎 编辑:程序博客网 时间:2024/04/30 20:22

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重新赋值即