1

我想在 extjs 中做级联组合框。我必须组合框

课程组合框

{ 
    xtype : 'combobox',  
    emptyText : 'Course',  
    id:'combo-course',  
    displayField : 'name',  
    valueField : 'id',  
    store:coursestore,  
    forceSelection: true,  
    triggerAction:'all',  
    queryMode: 'remote',  
    listeners: {  
        'select': {  
            fn:function(combo, value) {  
                var comboModule = Ext.getCmp('combo-module');  
                comboModule .setDisabled(true);
        comboModule .clearValue('');
        comboModule .getStore().removeAll();
        comboModule .getStore().load({
        params: {courseId: combo.getValue()}
         });
                comboModule .setDisabled(false);  
            }  
        }  
    }  
}

课程模块:

{
    xtype : 'combobox',  
    emptyText : 'Module',  
    id:'combo-module',  
    displayField : 'name',  
    valueField : 'id',  
    disabled:true,  
    remoteFilter:true,  
    store:coursemodulestore,  
    forceSelection: true,  
    queryMode: 'remote',  
    triggerAction:'all'
}

休息服务

    @Path("/coursemodule/{courseId}")
    public List<CourseModule> getAllCourseModules(@PathParam("courseId")String courseId ) {
        try {           
            return courseObj.getModulesForCourse(courseId);
                } catch (HibernateException e) {
            logger.debug(e.getMessage());
        }
        return null;
    }

当我运行应用程序并选择第一个组合框时,它仅在第一次在第二个组合框中显示正确的值;
但是当我第二次选择组合框时,它不会在第二个组合框中显示值。

4

3 回答 3

1

您似乎想清除已应用的过滤器。要删除已应用的过滤器,商店中有一个 clearFilter() 方法。您可以将其混合到您的代码中,类似于:

comboModule.clearValue();  
// new line to clear any filter applied to the store
comboModule.getStore().clearFilter(true);  
comboModule.getStore().filter('courseId',combo.getValue());  
于 2012-11-03T03:18:33.933 回答
0

您的问题很可能是 store.load() 是异步的。尝试在负载回调中传递其余的逻辑(过滤等)。

于 2012-11-02T17:34:53.433 回答
0

它是否在您第二次加载时显示 LoadMask?

使用它来覆盖该行为:

Ext.override(Ext.LoadMask, {
    onHide: function() {
    this.callParent();
  }
});
于 2012-11-11T14:59:31.880 回答