Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-1366

When binding Radio's "selectedItem" with a non-String object, zk throws ClassCastException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 6.5.1
    • 6.5.0
    • Databind 2
    • None
    • None

      Error Message:

      java.lang.ClassCastException: org.zkoss.reference.developer.mvvm.collection.model.Item
      at org.zkoss.bind.converter.sys.RadiogroupSelectedItemConverter.coerceToUi(RadiogroupSelectedItemConverter.java:59)
      at org.zkoss.bind.impl.LoadPropertyBindingImpl.load(LoadPropertyBindingImpl.java:74)
      at org.zkoss.bind.impl.PropertyBindingHandler.doLoadBinding(PropertyBindingHandler.java:171)
      at org.zkoss.bind.impl.PropertyBindingHandler.doLoad(PropertyBindingHandler.java:372)
      at org.zkoss.bind.impl.BinderImpl.loadComponentProperties(BinderImpl.java:1802)
      at org.zkoss.bind.impl.BinderImpl.loadComponent(BinderImpl.java:1779)
      at org.zkoss.bind.impl.BinderImpl.loadComponent(BinderImpl.java:1782)
      at org.zkoss.bind.impl.BinderImpl.loadComponent(BinderImpl.java:1782)
      at org.zkoss.bind.BindComposer$BinderKeeper$Loader.load(BindComposer.java:468)
      at org.zkoss.bind.BindComposer$BinderKeeper.loadComponentForAllBinders(BindComposer.java:450)
      at org.zkoss.bind.BindComposer.doAfterCompose(BindComposer.java:174)

      Reproducing Steps:

      1. use the following code to reproduce the exception.

      		<radiogroup selectedItem="@bind(vm.pickedItem)">
      			<vlayout children="@load(vm.itemList)">
      				<template name="children">
      					<radio label="@load(each)" value="@load(each)" />
      				</template>
      			</vlayout>
      		</radiogroup>
      

      vm.pickedItem is an Item object. vm.itemList is List<Item> object.

      public class Item {
      
      	private String name;
      }
      

      extracted from :
      https://zkbooks.googlecode.com/svn/trunk/devref/src/main/webapp/selection-radio.zul

            dennis dennis
            hawk hawk
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: