Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

Can't make work ViewFileItem with datasource imageFile field having base64 String

$
0
0
I have a datasource with an imageFile type field (and the name is also imageFile by the way) :

Code:

<field name="imageFile" emptyDisplayValue="Image file not found" title="Image file" type="imageFile" required="true" />
On the server side, the file is read as byte[], encoded into Base64 String and correct headers are added.
Example of String I get representing image binary :

"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAB4..."

On the client side, first I display this image as a field of a ListGrid :

Code:

// Image File
final ListGridField imageGridField = new ListGridField("imageFile", CatvMessages._instance.imageFile());
imageGridField.setType(ListGridFieldType.IMAGE);
imageGridField.setShowFileInline(true);

The ListGridField is added to ListGrid and everything works fine.
The grid displays the image.

Now when I edit one record of the grid, I have a DynamicForm to displays all databind values.

And I can't make a ViewFileItem display the Image and I don't know why, please help me.

I declare the ViewFileItem :

Code:

ViewFileItem viewFileItem = new ViewFileItem("imageFile", CatvMessages._instance.imageFile());
viewFileItem.setShowFileInline(true);

I declare the datasource to the DynamicForm and add the ViewFileItem (and others databind FormItems) to the DynamicForm

Code:

mainForm.setDataSource(dsImage);
mainForm.setItems(..., viewFileItem);

What I am missing ?

Viewing all articles
Browse latest Browse all 4756

Trending Articles