View Full Version : combobox in grid with propertyeditor
7 Jan 2011, 6:06 AM
I'm adding a column to a grid that is edited with combobox. I want to have these combobox fields formatted, so I'm setting a custom property editor. However it seems that the property editor methods are not called, so the entries are not formatted. Property editor is not used when combobox is used inside a grid, am I right? Or am I missing something? Hilfe bitte.
12 Jan 2011, 2:17 AM
If anyone is interested, here is my solution I've finally figured out. In my case it was about having comboboxes in grid filled with i18ned enums, i.e. enum values should be translated back and forth.
It turns out that a combobox cell (and the whole column as well) uses combobox only when editing the cell, beside that it's just plain grid cell, so when the cell is only shown, one has to use GridCellRenderer to have the values displayed properly. To convert values in combobox, just override preProcessValue and postProcessValue methods in CellEditor associated with the Combobox field, so when the user clicks the cell and then selects one of the items, values are converted appropriately.
Powered by vBulletin® Version 4.1.5 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.