Announcement

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

    Simple way of using 1 and 0 values in a boolean field

    Hi,

    I've got an xml DS (client only) that has a tag like this:
    Code:
    <b>1</b>
    containing either 1 or 0.
    I'd like to represent this as a DataSourceBooleanField in a ListGrid.
    Simply declaring a boolean Field raises this warning:
    Code:
    [ERROR] [myApp] - 16:38:28.362:TMR6:WARN:DataSource:BoolDS$499:BoolDS$499.x: value: "1" failed on validator: {type: "isBoolean",
    typeCastValidator: true,
    _generated: true,
    defaultErrorMessage: "Must be a true/false value.",
    resultingValue: false}
    The field is always rendered as a "disabled true" in the ListGrid, i.e. as a gray checked checkbox, regardless whether it is 0 or 1. Using it to filter the records using a criteria query works, however.

    This does not occur if true/false is used rather than 1/0.
    Is there a simple way to rectify this?

    Thanks,
    fatzopilot

    FF 26.0 (dev mode)
    Chrome Version 34.0.1847.116 m
    SmartClient Version: SNAPSHOT_v10.0d_2014-04-12/LGPL Development Only (built 2014-04-12)
    GWT 2.6.0

    #2
    We would suggest using actual boolean true/false values client-side, and using dataSourceField.sqlStorageStrategy to map to underlying database storage.

    Comment


      #3
      Hi,

      thanks for your response, however, the DS is client only and just displaying a read-only XML file.
      Is there some value path expression maybe that could do the trick?

      Regards,
      fatzopilot

      Comment


        #4
        You could add a FieldValueExtractor, or transformResponse() implementation if it's multiple fields.

        Comment


          #5
          FieldValueExtractor was the missing piece, thanks for the Pointer!

          Comment

          Working...
          X