Are empty values supported for a ComboBoxItem with a pick list? Here's my class:
I don't get any empty values in the list, I'm assuming this isn't supported with using a pick list.
For another workaround, I was looking at setting specialValues: https://www.smartclient.com/smartgwt...java.util.Map-
The documentation mentions a special constant "emptyStoredValue". How would I use that?
Thanks!
Code:
public final class MaterialAttrComboBoxItem extends ComboBoxItem { public MaterialAttrComboBoxItem(final long priceBookId, final long materialAttrTypeId) { setAddUnknownValues(false); setAllowEmptyValue(true); // DS values based on price book being positive or negative if (priceBookId > 0) { setOptionDataSource(DSConst.MaterialAttrSQL.DATASOURCE); setSortField(DSConst.MaterialAttrSQL.PRINT_CODE); final Criteria criteria = new Criteria(); criteria.addCriteria(DSConst.MaterialAttrSQL.PRICE_BOOK_ID, priceBookId); criteria.addCriteria(DSConst.MaterialAttrSQL.MATERIAL_ATTR_TYPE_ID, materialAttrTypeId); setOptionCriteria(criteria); setPickListFields(new ListGridField(DSConst.MaterialAttrSQL.PRINT_CODE), new ListGridField(DSConst.MaterialAttrSQL.PRINT_DESCRIPTION)); setValueField(DSConst.MaterialAttrSQL.PRINT_CODE); setDisplayField(DSConst.MaterialAttrSQL.PRINT_CODE); } else { setOptionDataSource(DSConst.MaterialAttrPBDBSQL.DATASOURCE); setSortField(DSConst.MaterialAttrPBDBSQL.PRINT_CODE); final Criteria criteria = new Criteria(); criteria.addCriteria(DSConst.MaterialAttrPBDBSQL.PRICE_BOOK_ID, -priceBookId); criteria.addCriteria(DSConst.MaterialAttrPBDBSQL.MATERIAL_ATTR_TYPE_ID, materialAttrTypeId); setOptionCriteria(criteria); setPickListFields(new ListGridField(DSConst.MaterialAttrPBDBSQL.PRINT_CODE), new ListGridField(DSConst.MaterialAttrPBDBSQL.PRINT_DESCRIPTION)); setValueField(DSConst.MaterialAttrPBDBSQL.PRINT_CODE); setDisplayField(DSConst.MaterialAttrPBDBSQL.PRINT_CODE); } final ListGrid pickListProps = new ListGrid(); pickListProps.setAlternateRecordStyles(true); pickListProps.setAutoFitData(Autofit.HORIZONTAL); pickListProps.setAutoFitFieldWidths(true); pickListProps.setAutoFitWidthApproach(AutoFitWidthApproach.BOTH); setPickListProperties(pickListProps); } }
For another workaround, I was looking at setting specialValues: https://www.smartclient.com/smartgwt...java.util.Map-
The documentation mentions a special constant "emptyStoredValue". How would I use that?
Thanks!
Comment