Which approach is better for CellTable - TextColumn with dynamic style OR Column with ImageResource?

17 views
Skip to first unread message

andy_p1

unread,
May 20, 2013, 10:14:28 AM5/20/13
to google-we...@googlegroups.com
Hi,
 I am creating a moderate sized CellTable - 100 rows and 5 columns. In some of the columns I need to show small images (no text) depending on the value returned by the accessor method of the backing object for the row. The number of images are fixed i.e. the logic is basically to display one of 5 images in a cell.

I had trouble working with a ClientBundle for my Images so as a work around, I did it with the following approach:

TextColumn<RowData> markedColumn = new TextColumn<RowData>() {
        public String getValue(RowData object) {
          return "";
        }
        public String getCellStyleNames(Context context, RowData  object) {
            if(object.getMarkedStatus()){
            return "MARKED";
            }
            else{
            return "";
            }
    }
      };

Now, my ClientBundle stuff is working and the following code works as well:

Column<RowData, ImageResource> markedColumn1 = new Column<RowData, ImageResource>(new ImageResourceCell()) {
      public ImageResource getValue(RowData object) {
        if(object.getMarkedStatus()){
            return ImageResourceBundle.INSTANCE.rtick(); 
        }else{
            return null; <-- I am not sure how to create an Empty cell. I guess I can return an empty/blank image here.
        }
      }
    };

Now, I am not sure which approach is better. I am thinking that since stylesheets are in generate better in performance, the first approach is better. Is that correct? The app will be used on mobile devices.

thank you!
Reply all
Reply to author
Forward
0 new messages