I am working with NatTable in my Java application, and I have a specific requirement related to the filter row and combo filters. In my NatTable, I have a filter row with combo box filters, and I would like to dynamically change the options available in one combo box based on the selection made in a previous combo box in the same row.
For example, if the user selects an option in the first combo box, I want to update the options available in the second combo box in the same row dynamically.
I am currently using EditConfigAttributes.CELL_EDITOR
to handle cell combo values. However, I'm unsure about the best way to dynamically update the options of the combo box based on the selection in a previous combo box.
Could someone provide guidance or an example code snippet on how to achieve this in NatTable? Any help or insights would be greatly appreciated!
Collections.sort(EZPDContants.STATUS_LIST);
ComboBoxCellEditor comboBoxCellEditor = new ComboBoxCellEditor(MyContants.STATUS_LIST);
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, comboBoxCellEditor, DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 0);
Collections.sort(EZPDContants.SOP_LIST);
ComboBoxCellEditor attributeValue = new ComboBoxCellEditor(MyContants.SOP_LIST);
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, attributeValue, DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 1);
Thank you in advance.
Instead of passing a fixed list you can create the
ComboBoxCellEditor
with aIComboBoxDataProvider
. That one somehow needs to know the context to determine which values to return.See https://eclipse.dev/nattable/documentation.php?page=faq for an example.