Announcement

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

    Converting string values to boolean for checkbox in ListGrid

    First of all I have to say that I've searched this forum for this issue and found many threads but none of them helped me to solve my problem that's why I've decided to start new one.

    What I'm trying to accomplish here is to use my database column with 2 distinct string values ("T","N") as the source for the field in ListGrid displayed as checkbox.

    This field is declared as:
    Code:
    <field name="GABARYTOWANIE">
           	<valueMap>
                 <value id="T">true</value>
                 <value id="N">false</value>
            </valueMap>
            <editorType>CheckboxItem</editorType>
    </field>
    My datasource is bound to ListGrid and DynamicForm.

    DynamicForm works as expected: displays checkbox, checked for "T" and unchecked for "N", updates properly and so on...

    ListGrid, however, doesn't work as expected:
    - in the filter it displays checkbox and filtering works fine
    - in the display mode it shows true/false (no checkbox)
    - in the edit mode it displays checkbox checked regardless of the current field value and if updated sends "true"/"false" strings to database

    To be honest I'm puzzled by inconsistency of the behaviour between ListGrid and DynamicForm. Is it intentional behaviour or bug?
    If it's intentional how do I make ListGrid to display checkboxes and work properly in edit mode?

    I will appreciate any help on this.

    Regards,
    tlas

    #2
    We've made this easier, so no need for this approach anymore. See sqlStorageStrategy - declare the field as "boolean", set sqlStorageStrategy, no need for anything else (valueMap / editorType).

    Comment


      #3
      Thanks for your response.
      I'm not sure if I got it right but all I can set for sqlStorageStrategy for boolean fields is (according to docs):

      * "number" or "integer": store true as 1, false as 0
      * "singleChar10": store true as "1", false as "0"
      * "singleCharYN": store true as "Y", false as "N"
      * "singleCharTF": store true as "T", false as "F"

      What I need is to store true as "T", false as "N". How do I do it? Is it really possibile to map values other then provided?

      Regards,
      tlas

      Comment

      Working...
      X