单击列更改视图

时间:2014-06-13 10:16:37

标签: sapui5

我是SAPUI5的新手,我在这个例子中创建了一个表 - > Demo Link。现在我想在表列上创建一个“链接”。例如,通过单击LastName“Ander”,应用程序将视图更改为“ander view”。怎么做?

2 个答案:

答案 0 :(得分:1)

您可以创建如下所示的链接

var oLink1 = new sap.ui.commons.Link({
text: "Link to Action", 
tooltip: "This is a test tooltip",
press: function() {
    //to go to external link use below code
    window.location.replace("http://mywebsite.com/nextPage.html");

    //to change the view use this
    var view = sap.ui.view({id:"idSecondPage", viewName:"project.secondPage", type:sap.ui.core.mvc.ViewType.JS});
    view .placeAt("sample1"); 

});

现在将其添加到模板

的表格列中
    oTable.addColumn(new sap.ui.table.Column({
    label: new sap.ui.commons.Label({text: "Web Site"}),
    template: oLink1
}));

答案 1 :(得分:0)

首先:你到现在为止尝试了什么?

第二:一般来说我正在使用jQuery 例如:

$(viewToHide).fadeOut();
$(viewToShow).fadeIn();
//or use any other of the hide/show functions for that

其中两个变量是特定视图的ID,例如#anderView