【问题标题】:SAP UI5 XML View Tiles Icon not workingSAP UI5 XML View Tiles 图标不起作用
【发布时间】:2014-10-16 12:28:14
【问题描述】:

我有一个 XML 视图:

<mvc:View height="100%" xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m" controllerName="my.own.controller">
<App>
    <Page showHeader="false" enableScrolling="false">
        <TileContainer id="container" tileDelete="handleTileDelete" tiles="{/TileCollection}">
            <StandardTile icon="sap-icon://{icon}" number="{number}" title="{title}" info="{info}" infoState="Success" />
        </TileContainer>
        <footer>
        </footer>
    </Page>
</App>

我有一个js:

function initialLoad(){

// create some dummy JSON data
var data = {
        "TileCollection" : [{
                                "icon":"history",
                                "number":"3",
                                "title" : "Project History",
                                "info": "click to view",
                                "infoState" : "Success"
                            }]
};

// instantiate the View
sap.ui.localResources("XMLViews");
var app = new sap.m.App({initialPage:"welcome"});
var myView  = sap.ui.xmlview({id:"welcome", viewName:"XMLViews/welcome"});
app.addPage(myView);

// create a Model and assign it to the View
var oModel = new sap.ui.model.json.JSONModel();
oModel.setData(data);
myView.setModel(oModel);

// put the View onto the screen
myView.placeAt("content");}

问题是图标没有显示。如果我在我的 XML 视图中硬编码:

icon="sap-icon://history"

那么图标就正确显示了。

我被这个问题困扰了一天,如果你能给我一些提示,我很感激!

谢谢!

【问题讨论】:

    标签: tiles sapui5


    【解决方案1】:

    将数据绑定到icon 属性的方式不正确。应该是这样的。

    icon="{icon}"
    

    改为在您的 json 中进行如下更改:

    var data = {
            "TileCollection" : [{
                                    "icon":"sap-icon://history", 
                                    "number":"3",
                                    "title" : "Project History",
                                    "info": "click to view",
                                    "infoState" : "Success"
                                }]
    };
    

    我认为这会奏效。

    猜你喜欢
    • 2023-03-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-22
    • 2019-05-12
    • 2020-02-21
    相关资源
    最近更新 更多