Skip to Content
0
Sep 22, 2020 at 08:23 PM

SAPUI5 - svg disappearing after reload

169 Views Last edit Sep 22, 2020 at 08:36 PM 3 rev

I have a view with a GridList where the items contain .svg images.

When I access this view through navigation, It displays the images correctly:

But when I reload, some .svg images initially appear, but shortly after disappear:

This is the GridList XML code:

<f:GridList
    id="inVenditaList"
    items="{path: 'marcheAutoInVendita>/'}"
    mode="SingleSelectMaster"
    select=".onMarcaPress"
    busyIndicatorDelay="0">
        <f:customLayout>
            <grid:GridBoxLayout boxWidth="80px"/>
        </f:customLayout>
        <f:GridListItem>
            <VBox>
                <OverflowToolbar design="Solid" class="sapUiSmallMarginBottom">
                    <Text text="{marcheAutoInVendita>nome}" class="marcaNome"/>
                </OverflowToolbar>
                <VBox alignItems="Center">
                    <Image src="data:image/svg+xml;base64,{marcheAutoInVendita>immagine}" width="60px" height="auto"/>
                </VBox>
            </VBox>
        </f:GridListItem>
</f:GridList>

The model is setted after an AJAX request to my REST service:

$.ajax({
    url: oBundle.getText("backendURL") + "auto/autoInVendita/getMarche",
    data: {
        id: oImpiegatoModel.getProperty("/id")
    },
    type: "POST",
    dataType: "json",
    crossDomain: true,
    beforeSend: function() {
        oView.byId("inVenditaList").setBusy(true);
    }
})
.done(function (oDataInVendita) {
    var oMarcheModel = oView.getModel("marcheAutoInVendita");
    if (!oMarcheModel) {
        oMarcheModel = new JSONModel();
        oView.setModel(oMarcheModel,"marcheAutoInVendita");
    }
    oMarcheModel.setData(oDataInVendita);
    oView.byId("inVenditaList").setBusy(false);
});

I really don't know how to solve.

Thanks in advance.