Problem uploadin an image into a table

Hi all, I am trying to upload an image and show it right away in a table. Problem is that the when the table is painted after the upload the table size is only 1 row (tblPics.setPageLength(0)). If the image is larger there will be a scrollbar.

I’m using ThemeResource for showing the image and it’s pointing to a servlet which loads the image using an image id. There might be a better way but this is what I managed to make partially work.

Funny part of the story is that if I do it following way (static file id) the table is resized correctly:

pic.setSource(new ThemeResource("../../../" + DocumentUI.url+"?fileId=9026&Action=open"));

If I use a variable to hold the fileId table doesn’t get resized, the length is 1 row and there is a scrollbar to view the whole image:

pic.setSource(new ThemeResource("../../../" + DocumentUI.url+"?fileId=" + fileId + "&Action=open"));

Any suggestions are highly appreciated :slight_smile:

Edit: looks like the code blocks above behave exactly like the table. What am I doing wrong? The 2nd code block looks like this: pic.setSource(new ThemeResource(“…/…/…/” + DocumentUI.url+“?fileId=” + fileId + “&Action=open”));

Hi

I am afraid you’ll need to acquire actual image dimensions beforehand and set width and height of your pic object explicitely. That way the table will compute cell dimension requirements accordingly yet before rendering.

At least that was the trick I used to get rid of undesired Table scrollbars. Quite a bit painful but 100% effective.

Thanks, that did the trick.