Announcement

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

    How to post hidden data with datasource

    Hi
    I'm using Smart GWT Pro 2.4.
    I have a dynamic form bound to a data source.

    The form.saveData() call is working perfect, except - how do I send hidden data back to the server.

    In this case - the SelectItem ID.
    My SelectItem display a description, but also have the database ID hidden in the datasource.
    See the following code extract:

    Code:
    DataSourceTextField  description = new DataSourceTextField("Description", "description", 30);
    DataSourceTextField  id = new DataSourceTextField("code", "Code", 2);
    id.setHidden(true);
    DataSource dataSource = new DataSource();
    dataSource.setID("dataSourceName");
    dataSource.setFields(description, id);
    
    SelectItem mySelect = new SelectItem("fieldName", "title");
    mySelect.setOptionDataSource(dataSource);
    The save data bring back the description of the option selected, but I need the ID.
    Can anyone help please?

    #2
    This thread is in essence the same as thread http://forums.smartclient.com/showthread.php?t=12124.
    But, thread http://forums.smartclient.com/showthread.php?t=12124 still complained about a bug that I still experience.
    Can someone from Isomorthic please respond to thread's http://forums.smartclient.com/showthread.php?t=12124 last question?

    Comment


      #3
      Hidden fields are passed when declared as part of the DS.

      Be sure to set the valueField and displayField properties of your SelectItem to determine what field of the optionDataSource will be saved.

      You may need to provide a standalone test case if this doesn't fix your issue.

      Comment


        #4
        Thanks David
        Well, I was hoping for a more elegant solution. Things like authentication information is handy to send with, without adding it to your every recordset returned or criteria.
        As I said, the thread mentioned in my previous post does actually answer the question, but there is a bug that is preventing it to happen.
        I would like to know when will this bug be addressed?

        Comment

        Working...
        X