Go Back   SmartClient Forums > Smart GWT Technical Q&A
Wiki Register Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 3rd Sep 2010, 06:36
tlas tlas is offline
Registered Developer
 
Join Date: Jan 2009
Posts: 4
Default 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
Reply With Quote
  #2  
Old 3rd Sep 2010, 09:39
Isomorphic Isomorphic is offline
Administrator
 
Join Date: May 2006
Posts: 30,600
Default

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).
Reply With Quote
  #3  
Old 6th Sep 2010, 04:52
tlas tlas is offline
Registered Developer
 
Join Date: Jan 2009
Posts: 4
Default

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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search


© 2010,2011 Isomorphic Software. All Rights Reserved