Announcement

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

    5.1 BatchUploader (hidden) fields with default value not working

    Hi Isomorphic,

    I need to transmit default values with the client BatchUploader.
    I defined a ListGridField like this and added it to the batchUploader.setGridFields().
    Code:
            {
                ListGridField inputchannelLGF = new ListGridField("INPUTCHANNEL");
                inputchannelLGF.setDefaultValue("upload");
            }
    (In my application I'd finally also make it setHidden(true) and setCanHide(false)).

    Unfortunately the defaultValue is not used in the rows of the upload grid (the value is null in all rows).

    Is this a bug? What is the correct way to solve this? I'm using latest 5.1p

    Thank you & Best regards
    Blama

    #2
    The 'defaultValue' for a ListGrid field is used only when the field is actually being edited, so if you never put the grid into edit mode this won't get picked up.
    (This is expected behavior and makes sense in standard grid editing usage)

    You could handle this in a couple of ways.
    One option would be to use the BatchUploader 'uploadOperation' to specify a particular add operation on the target dataSource for when rows are actually being uploaded, and have custom server logic to set a default value for the field in question.
    This would not cause these defaults to show up in the preview grid - the values would be added when the previewed records were accepted by the user and committed only. Given that this field is intended to be hidden, this seems like it would not be a problem for you.

    Alternatively if you wanted to handle this entirely on the client side, you could use the 'setEditValue()' API on the batch uploader grid to inject an edit value into the preview data before it gets uploaded for every row where the field in question has no value.
    You could probably achieve this with a drawHandler on the 'grid' autoChild (applied via setAutoChildProperties()), or similar.

    Comment


      #3
      Hi Isomorphic,

      thank you for the fast answer. I'm going for this solution:
      Originally posted by Isomorphic View Post
      One option would be to use the BatchUploader 'uploadOperation' to specify a particular add operation on the target dataSource for when rows are actually being uploaded, and have custom server logic to set a default value for the field in question.
      Best regards
      Blama

      Comment

      Working...
      X