I have a datasource with an imageFile type field (and the name is also imageFile by the way) :
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 :
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 :
I declare the datasource to the DynamicForm and add the ViewFileItem (and others databind FormItems) to the DynamicForm
What I am missing ?
Code:
<field name="imageFile" emptyDisplayValue="Image file not found" title="Image file" type="imageFile" required="true" />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 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);Code:
mainForm.setDataSource(dsImage);
mainForm.setItems(..., viewFileItem);