计算 XPage 视图中的条目 [英] Count entries in XPages view

查看:30
本文介绍了计算 XPage 视图中的条目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 XPage 有一个视图数据源,其中包含从 URL 参数构建的搜索公式(在视图结果中搜索").

My XPage has a view data source with a search formula ("Search in view results") constructed from URL parameters.

搜索结果显示在位于面板内的重复控件中.如果没有搜索结果,我想隐藏此面板并显示适当的消息.

The search results are displayed in a repeat control that sits inside a panel. I want to hide this panel if there are no search results and display an appropriate message instead.

面板基于以下代码可见:

The panel is visible based on the following code:

var vec:NotesViewEntryCollection = view1.getAllEntries();
vec.getCount() != 0;

但是,似乎 getAllEntries 在过滤发生之前返回视图中的所有条目.AllEntries 的帮助说明如果视图被 FTSearch 过滤,则此属性返回过滤视图中的条目."

However it seems that getAllEntries returns all entries in the view before the filtering takes place. The Help for AllEntries says "If a view is filtered by FTSearch, this property returns the entries in the filtered view."

我误解了吗?有没有办法在过滤后获得条目数?

Have I misunderstood this? Is there a way that I can get the number of entries AFTER the filtering has taken place?

推荐答案

当您通过 SSJS 访问 dominoView 数据源时,您获得的不是 dominoView,而是与其关联的 NotesView.这就是 NotesView 类可用的属性和方法的原因.但是搜索是在 dominoView 数据源前端而不是与之关联的 NotesView 对象上执行的.

When you're accessing the dominoView datasource via SSJS you're not getting the dominoView but the NotesView associated with it. That's why the properties and methods available are for the NotesView class. But the search is being performed on the dominoView datasource front-end not on the NotesView object associated with it.

不要使用数据源,而是获取使用它的控件(例如重复、视图面板等)并使用 getRowCount() 方法.这会给你正确的总数.例如

Instead of using the datasource, get the control that uses it (e.g. A repeat, viewPanel etc) and use the getRowCount() method. This will give you the right total. E.g.

getComponent("repeat1").getRowCount() 

这篇关于计算 XPage 视图中的条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆