Announcement

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

    DetailViewerField Type Image issue

    Hi,

    I am following all the steps from the SmartGWT Showcase regarding how to set up TileGrid with images.

    I use only two DetailViewerFields. One for the image and the other for the image description.
    The data for the image DetailViewerField is stored as a Base64 file. I convert that in the DataSource using the encodeInResponse class.
    The issue I am running into is a 404 error. It is acting like the images are stored in the project rather then them being pulled from the data source.
    Is there a way to get these URL's correctly?

    Code:

    DataSource fields:
    <field name="image" type="binary" encodeInResponse="true"/>
    <field name="name" type="text" length="100"/>

    TileGrid and Fields:
    TileGrid tileGrid = new TileGrid();
    tileGrid.setTileWidth(180);
    tileGrid.setTileHeight(180);
    tileGrid.setWidth100();
    tileGrid.setHeight100();
    tileGrid.setSelectionType(SelectionStyle.SINGLE);
    tileGrid.setDataSource(DATASOURCE);

    final DetailViewerField imageField = new DetailViewerField("image");
    imageField.setType("image");
    tileGrid.setFields(imageField, new DetailViewerField("name"));

    404 Error:
    NOT FOUND

    414 Error:
    URL TOO LONG


    #2
    Type “image” is for URLs, and a base64 encoded image is not a URL.

    You could make it a URL by prepending “data:”, or you could specify type “imageFile”.

    Comment

    Working...
    X