Announcement

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

    fill datasource fields by grid AND code

    Hi,

    how can I add additional values to a DSRequest just before it is getting saved?
    Let`s say I have a grid where a user can add information about himself. Now there are some values which I already know, for instance the userName (on client- and serverside).
    Now I want to merge the already known fields with the information he added and store everything via SQL DataSource to a table.

    My question is: Where would be the right place to add that already known data?
    I`m adding the information by using the startEditingNew() method:

    Code:
    final IButton btnAddUser = new IButton("add user");
            btnAddUser.addClickHandler(new ClickHandler()
            {
                @Override
                public void onClick(ClickEvent event)
                {
                    userGrid.startEditingNew();
                }
    });
    is there any handler which I can use for the listGrid or do I have to define an add-operation in my ds.xml?
    I`m sure this is a common procedure so I hope someone can help me.

    #2
    Is the presence of these field values considered a security concern? Do it server-side: see QuickStart Guide sections on DMI and operationBindings.

    Do you want the added fields treated as user edits? Then yes, startEditingNew or setEditValue is correct, see also the ListGrid Editing Overview.

    Is it just a way of factoring code to incorporate some values that the server needs but the user shouldn't have to see? Then consider also DataSource.transformRequest.

    Comment


      #3
      Allright, thanks for your quick answer. I used the operationBindings which is working quite well.

      For those who have similar problems and found this thread:

      My field values are user related and stored in my HttpServletRequest object. So I created my own IDACall and added them to the DSRequest within the 'handleDSRequest-method:

      Code:
      public DSResponse handleDSRequest(DSRequest dsRequest, RPCManager rpc,
                  RequestContext context) throws Exception
          {
              dsRequest.addToTemplateContext("eMail", email);
              ...
      this way I can use the value for my add operation:

      Code:
      <operationBindings>
      	<operationBinding operationType="add">
      		<values fieldName="eMail" value="$eMail" />
      	</operationBinding>
      </operationBindings>
      Thanks again.

      Comment

      Working...
      X