Currently using smarclient 3.0 on RHEL 5.x and firefox 10. I have a listgrid with the filter editor visible. 3 columns have select items with datasources. They are multiple selects. One of these columns I'd like it to depend on another one, with the 3rd one independent. However, I'm stuck trying to get the selections from the first select item and creating the criteria for the 2nd one. Is it possible to achieve this for multiple select items? Is there an example I can look at or any advice I can have?
Code:
// Get the master field and set its datasource ListGridField masterField = theListGrid.getField(masterFieldName); masterField.setOptionDataSource(DataSource.get(masterDataSourceName)); masterField.setAutoFetchDisplayMap(true); // Get the dependent field and set its datasource final ListGridField dependentField = theListGrid.getField(dependentFieldName); dependentField.setOptionDataSource(DataSource.get(dependentDataSourceName)); dependentField.setAutoFetchDisplayMap(true); SelectItem selectItem = new SelectItem(); selectItem.setMultiple(true); selectItem.addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent event) { String selectedItem = (String) event.getValue(); /*dependentField.setOptionCriteria(optionCriteria);*/ } }); selectItem.setAllowEmptyValue(true); SelectItem dependentSelectItem = new SelectItem(); dependentSelectItem.setMultiple(true); masterField.setEditorType(selectItem); dependentField.setEditorType(dependentSelectItem); }
Comment