0

我有一个数据表,我想在单击它的每一行时显示详细信息。但索引总是返回 0。

int index= wdContext.getCurrentElement().index();
wdComponentAPI.getMessageManager().reportSuccess("test "+ index);

在此处输入图像描述

请帮我复习并给出你的想法。

4

1 回答 1

0

您在这里有几个选择。第一个选项

wdContext.node<YourNode>.getLeadSelection().index();

注意获取节点的潜在客户选择,而不是根上下文。还应正确定义上下文映射以使其正常工作。

第二种选择是使用wdDoModifyView 事件

wdDoModifyView(...)
{
if (firstTime)
 {
  IWDLinkToAction link = (IWDLinkToAction) view.getElement("LinkID");
  link.mappingOfOnAction().addSourceMapping("nodeElement", "rowElement");
 }
}

在这里,我们将内置参数映射到将在LinkToActionnodeElement处理程序中使用的目标参数。rowElemen

void onActionLinkClicked(..., I<DataSourceNode>Element rowElement)
{
 /* do whatever with row element */
}
于 2016-10-20T12:14:13.423 回答