Announcement

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

    Select the array object to the SelectItem field

    Hello,

    I am using SmartGWT 3.1 Power Edition (2013 May 12 nightly build) and PostgresSQL.

    I have PostgresSQL table,
    -id int
    -cycles text[] (array of text)

    I have created the ds.xml to handle this table's CRUD operation.
    Code:
    	<fields>
            <field name="id" type="integer" hidden="true" primaryKey="true"/>
            <field name="cycles" title="Cycles" optionDataSource="amrSiteData" displayField="cycle" valueField="cycle" multiple="true"/>
        </fields>
    Issue 1:
    I got stuck at one point, i need to display the "cycles" Selectitem field with
    setMultipleAppearance(MultipleAppearance.PICKLIST) and setMultiple(true) options. This SelectItem will be displayed in the DynamicForm.

    When, i will call the form.saveData() method, form will convert the SelectItem value as, {selectitem_name=[01, 02]}. But PostgresSQL throws error as it is expecting the value to be {selectitem_name={01, 02}}.

    Now what should be done in this case?

    Issue 2:
    To check the fetch operation i have added dummy data in table,
    id = 0
    cycles = {01, 02}

    Now when i do the fetch operation,

    Code:
    form.fetchData(null, new DSCallback() {
    			
    			@Override
    			public void execute(DSResponse response, Object rawData, DSRequest request) {
    				if(response.getData().length > 0){
    					record = response.getData()[0];
                                            form.editRecord(record);
                                     } ..................................
    It is displaying the data as, [object Object] in the SelectItem box. I am not getting how to get the [01, 02] value from it and display it as selected in the SelectItem box.

    Any help/guidance will be great as this is very important feature in my first release of product. Thanks in advance.
Working...
X