Announcement

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

    Record and Multiple fields

    SmartClient Version: SNAPSHOT_v8.3d_2012-08-01/LGPL Development Only (built 2012-08-01)

    Hi
    We have a problem with setting multiple field values in a ValueManager that hopefully you can help us with.

    We have a Form with rather a lot of custom code but it is backed by a ValueManager which is tied to a custom DataSource.

    We have a field that is marked multiple = true in the DataSource and have our own listing window for adding multiple items to the form.

    The listing window has a callback into the valueManager which updates the existing record with setAttribute (if the record exists).


    Code:
       private void setMultipleFieldValues(String itemName, String[] values)
       {       
           if(record!=null)
           {           
        	   record.setAttribute(itemName, values);
           }
           Map map = this.getValues();
           map.put(itemName, values);
           this.setValues(map);
       }
    For an Update, when save is called we save any other values in the form into the Record and call editRecord on the ValueManager.

    Before this call if we do a getAttributeAsStringArray on the Record for that field in question the values are returned correctly.

    After the call to editRecord, in our extended DataSource when we check the value of the attribute in the Record, again using getAttributeAsStringArray we see [object Object] for any new value we added.

    So somewhere between editRecord in the ValueManager and transformRequest in the DataSource any NEW values are over written as [object Object] and we don't know why.

    We do see trace that says
    Code:
    TextItem:isc_TextItem_3[myField]:$952 - this is a multiple FormItem but newValue is not null and is not an array.
    But I assumed thats only because we are by passing the form and adding the values directly to the record.

    Whats really infuriating is that in gwt debug mode, this works perfectly. In compiled javascript it doesn't for firefox, chrome or IE.

    Incidentally, the reverse works correctly. From a Fetch, in our DataSource we call setAttribute with a String[] and we see the expected multiple values in the form.
    Last edited by mike_mac; 14 Nov 2012, 13:13.

    #2
    Since this works in GWT debug mode and not in compiled mode, you should try upgrading or downgrading GWT itself since that appears to be where the problem is.

    Aside from that, there's little that we can comment on here; we'd need a way to reproduce the problem, and the prose description just doesn't have enough detail to even speculate on a cause.

    Comment


      #3
      Forgot to update this ...
      You were right ! it was the GWT version. It works in 2.5, didn't work in 2.4.

      My first bug in GWT ! Thanks for your help.

      Comment


        #4
        A further note: we were having problems with setAttribute mistakenly binding a map to a field that was clearly a string value. Updating to GWT 2.5 fixed the issue.

        Comment

        Working...
        X