Products | Versions |
---|---|
TIBCO EBX | All supported versions. |
When trying to disable the preview button of a combo box in the DMA, or with UIComboBox.setPreviewButtonDisplayable(false), the button is still displayed.
This is a known limitation of combo boxes. The preview button is not deactivable when the editor is disabled for that field.
The editor is disabled in three cases:
A bug report about this subject exists, but it is not planned in the product roadmap because it requires heavy changes.
Bug reference: #CP-5222
The workaround consists of implementing a custom widget that will write the raw value of the foreign key label in the context in which you want to disable the preview button.
Example: Disable the preview button in the context of a table view.
Here is the implementation of the write() method of the UISimpleCustomWidget:
MyCustomWidget.javapublic void write(WidgetWriter writer, WidgetDisplayContext context) { if (context.isDisplayedInTable()) { // If the widget is displayed in the context of a table view ValueContext valueContext = context.getValueContext(); Object value = valueContext.getValue(); // Get the field value from the ValueContext String label = context.displayOccurrence(value, true ); // Retrieve the label writer.add(label); // Write the label } else writer.addWidget(Path.SELF); // In other cases, display the default widget (combo box) } |