Xpages 视图面板找不到数据变量rowData-找不到错误

Xpages 视图面板找不到数据变量rowData-找不到错误,xpages,Xpages,我在选项卡式面板中有一个视图面板,其data>var属性设置为rowData。我将此视图设置为使用viewScope值模拟单一类别视图 当我打开一个XPage并单击视图面板存在的选项卡时,有时会弹出此错误(JavaScript代码中的第2行是错误所在): JavaScript代码 1: var href = facesContext.getExternalContext().getRequest().getContextPath(); **2: var docUNID = rowData.ge

我在选项卡式面板中有一个视图面板,其data>var属性设置为rowData。我将此视图设置为使用viewScope值模拟单一类别视图

当我打开一个XPage并单击视图面板存在的选项卡时,有时会弹出此错误(JavaScript代码中的第2行是错误所在):


JavaScript代码

1: var href = facesContext.getExternalContext().getRequest().getContextPath();
**2: var docUNID = rowData.getDocument().getUniversalID();**
3: var formName = rowData.getDocument().getItemValueString("Form");
4: var formType = rowData.getColumnValue("Form")
5: 
6: if(formName == "clientProfile") {
7:  href + "/clientProfile.xsp?documentId=" + docUNID + "&action=openDocument&rtr=yes";
8: }
9: else {
10:     href + "/speakerProfile.xsp?documentId=" + docUNID + "&action=openDocument&rtr=yes";
11: }

上面引用的viewColumn2是视图中具有以下公式的列:

@ReplaceSubstring(Form; "clientProfile" : "clientFeed" : "speakerProfile" : "speakerFeed"; "Client Profile" : "Client Feedback" : "Speaker Profile" : "Speaker Feedback")
我不确定这将如何引发上述错误——在大多数XPages上单击该选项卡可以正常工作

视图中显示的文档没有什么特殊之处。我比较了其中两个--一个显示错误,另一个抛出错误,我没有发现任何可能导致这个问题的差异

我无法确定为什么有时会出现错误,有时不会


任何帮助都会很好

如果视图被分类,并且代码命中的是类别而不是文档,则可能会发生此错误。您可以使用以下代码确保当前行不是类别:

if (!rowdata.isCategory()) {
// insert your code here
}
当然,这段代码假设rowData可用,因此这可能无法解决您的问题

示例代码可以在Notes&Domino应用程序开发wiki中找到:

如果视图已分类,且代码命中的是类别而不是文档,则可能会发生此错误。您可以使用以下代码确保当前行不是类别:

if (!rowdata.isCategory()) {
// insert your code here
}
当然,这段代码假设rowData可用,因此这可能无法解决您的问题

示例代码可以在Notes&Domino应用程序开发wiki中找到:

尝试使用不同的变量名curRowData——不要忘记,这些内容是区分大小写的。另外,由于rowData.getDocument初始化了一个不可回收的NotesDocument,因此您的代码是一个巨大的内存泄漏

尝试使用:

var result;
if (curRowData.isCategory()) {
   return "";
}
var href = facesContext.getExternalContext().getRequest().getContextPath();
try {
   var doc = curRowData.getDocument();
   if (doc != null) {
      var docUNID = doc.getUniversalID();
      var formName = doc.getItemValueString("Form");
      var formType = curRowData.getColumnValue("Form")
          if(formName == "clientProfile") {
          result = href + "/clientProfile.xsp?documentId=" + docUNID + "&action=openDocument&rtr=yes";
      } else {
        result = href + "/speakerProfile.xsp?documentId=" + docUNID + "&action=openDocument&rtr=yes";
      }  
   }
} catch (e) {
  // some error handling
}
if (doc != null) {
   doc.recyle();
}
return result;

当然,您最好只向视图中添加所有需要的值。省去了创建NotesDocument对象的必要性尝试使用不同的变量名curRowData,并且不要忘记这些内容区分大小写。另外,由于rowData.getDocument初始化了一个不可回收的NotesDocument,因此您的代码是一个巨大的内存泄漏

尝试使用:

var result;
if (curRowData.isCategory()) {
   return "";
}
var href = facesContext.getExternalContext().getRequest().getContextPath();
try {
   var doc = curRowData.getDocument();
   if (doc != null) {
      var docUNID = doc.getUniversalID();
      var formName = doc.getItemValueString("Form");
      var formType = curRowData.getColumnValue("Form")
          if(formName == "clientProfile") {
          result = href + "/clientProfile.xsp?documentId=" + docUNID + "&action=openDocument&rtr=yes";
      } else {
        result = href + "/speakerProfile.xsp?documentId=" + docUNID + "&action=openDocument&rtr=yes";
      }  
   }
} catch (e) {
  // some error handling
}
if (doc != null) {
   doc.recyle();
}
return result;

当然,您最好只向视图中添加所有需要的值。无需创建NotesDocument对象。请添加声明控件的XML的说明。
我自己也犯了这个错误,这是因为我计算列的方式错误;“Computed”vs JavaScript我想是…

请添加声明控件的XML的描述。 我自己也犯了这个错误,这是因为我计算列的方式错误;“Computed”vs JavaScript我想是…

感谢您的想法——不过,我仍然收到了“rowData not found”错误。。。任何其他想法都会很好!感谢您的想法--但是,我仍然收到“rowData not found”错误。。。任何其他想法都会很好!