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

ZK *SHOULD* coerce zul String types to numeric types in ViewModel

XMLWordPrintable

      I really feel this is a major issue (others may disagree but considering this isn't an issue in other web frameworks, I think it should be addressed.) Many times one will work with a domain level object within your view model. This domain object will often have numeric data types. If you attempt to use one of these domain objects in your view model and you attempt to set an int property directly on the domain object from the ui (eg a listitem with a value of "4") , it will not work. The property on your viewmodel or domain object has to be a String. This is incredibly annoying... it means one has to modify the domain level object (not typically a good idea), or provide a wrapper object for your domain object (adapter), or put those properties as Strings directly in your view model and do the conversions there to set your domain object. Wayyyyy too much work considering almost every other modern web framework does this sort of coercion automatically.

      Here is an example in ZK Fiddle. Note how the id property will not get set on Animal but the name property will: http://zkfiddle.org/sample/32ed7fb/7-Coercion-Bug-need-to-coerce-to-int

            Unassigned Unassigned
            rickcr rickcr
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: