Announcement

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

    Need design recommendation for a dynamic listgrid

    Greetings,

    I'm using 7.0rc2, with a Tomcat backend. I have a search results listgrid that does not have a datasource, I'm populating it with an RPC call. There are a number of possibilities on the number of columns and the names of the columns that are coming back from the server. I need to configure the listgrid columns, widths and titles dynamically, after I get the response back.

    I'm looking for a recommendation on the best technology approach to take with this. I'd prefer not to use anything XML based. It looks like there are a few options, but I'm not sure which path to go down. Can you provide a recommendation or point me to a section of the docs?

    Thanks,
    S

    #2
    Basically, create a DataSource that returns Records that have the attributes you want to supply to the ListGridFields - eg the fields of this DataSource would be "name", "width", "title", etc.

    Use DataSource.fetchData() and in the callback you'll be writing code like:

    Code:
        Record fromServer;
        ListGridField field = new ListGridField();
        field.setName(fromServer.getAttribute("name"));
        field.setTitle(fromServer.getAttribute("title"));   
        ...

    Comment


      #3
      Sorry, that's Smart GWT sample code. If you look at the docs for DataSource.fetchData(), you'll see an analogous example for FormItems (and the code is actually slightly simpler).

      Comment


        #4
        Thanks, I'll look that up. But how do I deal with the problem is not knowing the number of columns I'll get back?

        Comment


          #5
          Oh, I see, i'm creating new fields. Okay, I'll check this out. Thanks.

          Comment

          Working...
          X