Announcement

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

    TileGrid tiles using multiple columns

    Working with SmartGWT 2.5 in Chrome

    I'm very new to SmartGWT and am still getting used to the framework so I apologize if this is a commonly solved problem (I've searched the net and can't find an answer).

    I'm trying to use more than one column in a row within each tile of my TileGrid. For example, I want a title to be followed by a date (each in their own cell of the underlying table and both in the same row). I noticed that when I create a standard TileGrid using DetailViewerFields, they are each added as a single td in a tr, how do I expand this to use 2+ columns?

    The goal is to have two sets of text, each formatted differently but on the same row within a tile.

    Thanks in advance for any replies.

    #2
    A couple ways to do this:

    1) as shown in this sample, you can use tileGrid.fields to define fields that can include formatter functions which can introduce titles. This would give you selective display of titles, which is likely what you want (displaying titles in every tile is very redundant)

    2) You can use an override of getTile() to return arbitrary widgets as your tiles. A DetailViewer would give you the appearance you want.

    Comment


      #3
      Thanks for the reply.

      Overriding getTile(int recordNum) is working perfectly aside from one item.

      When I call tile = super.getTile(recordNum) I end up with a Canvas containing a string representation of the underlying Record. It looks like a VLayout of labels representing each field. When I call tile.removeChild(tile.getChildren()[0]), nothing happens. Any ideas?

      I'm using super.getTile because I want to inherit the listeners and CSS formatting that sets the class to tileOver, tileSelected, etc...

      Thanks again.

      Comment


        #4
        The default tiles are just a simple Canvas-based component containing HTML generated by a specially configured DetailViewer. They have no children. If you want to re-use the existing tiles, just replace the HTML via setContents().

        Comment

        Working...
        X