I'm working with a SmartGWT grid that has two fields. The second field needs to dynamically switch between a SelectItem and a TextItem based on the chosen value in the first field (which is also a SelectItem). Could you provide some code to achieve this functionality?
Announcement
Collapse
No announcement yet.
X
-
Hi lukepham90
see the code below. I have a non-editable first "type"-column and depending on that column I choose an editor.
You'll also need to look into context.getEditField() to always return a TextItem (?) for your 1st column and sth similar to my code for your second column:
Code:setEditorCustomizer(new ListGridEditorCustomizer() { public FormItem getEditor(ListGridEditorContext context) { String firstField = context.getEditedRecord().getAttributeAsString("firstField"); if (firstField.equals("selectYesNo")) { return new SelectItemYesNo(); } else if (firstField.equals("bigfield") { return new TextAreaItem(); } else { return new TextItem(); } } });
Best regards
Blama
Comment
Comment