gpt4 book ai didi

jquery - 如何在不实际选择sapui5中表的行的情况下获取行详细信息

转载 作者:行者123 更新时间:2023-12-01 04:10:06 26 4
gpt4 key购买 nike

我在 sapui5 中创建了一个表,其中数据从 SAP Gateway 后端填充。我在表中添加了一列,其中包含一个链接。每行都有一个链接。如果我单击该链接,则会打开一个弹出框。我想传递在弹出框中选择链接的同一行的其他列的详细信息。为了获取详细信息,我需要我不知道的该行的索引。

如何实现?

最佳答案

您可以使用 getSource()getParent() 方法来遍历控件层次结构,如下所示:

function linkPressListener(oEv) {
// get event source -> the link
var link = oEv.getSource();
// walk up the control hierarchy until you reach the table row (1st parent should be column, 2nd the row)
var row = link.getParent().getParent();

// get the rows index
var index = row.getIndex();

// get row context from the table
var myTable = sap.ui.getCore().byId("myTablesID");
myTable.getContextByIndex(index);

// open your dialog using the rows context
...
}

无论如何,像这样的层次结构对我来说似乎有点脆弱,希望看到一个更优雅的例子。

关于jquery - 如何在不实际选择sapui5中表的行的情况下获取行详细信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21600003/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com