Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    How to get SelectItem from ListGridField ChangedEvent

    I have a ListGrid that includes a field which has an optionDataSource and is correctly displayed as a SelectItem. I have added a ChangedHandler to the field so that when it is changed I can get the selected record and make use of other values in the record. However, in the ChangedHandler when I do this ...

    SelectItem sizeSelector = (SelectItem)event.getItem()

    But this generates a class cast exception saying "TextItem cannot be cast to com.smartgwt.client.widgets.form.fields.SelectItem"

    Why, if the field is visualized as a SelectItem, does the event.getItem() return a TextItem?

    #2
    This is a known limitation. Feel free to star the issue.

    As a workaround you can do

    SelectItem sizeSelector = new SelectItem(event.getItem().getJsObj());

    Sanjiv

    Comment


      #3
      Thanks as always for the quick response. I've starred the issue, but in the meantime the workaround works fine.

      Comment

      Working...
      X