过滤/搜索重复控制

时间:2016-04-21 21:36:56

标签: xpages xpages-ssjs

在我的应用程序中,我想用重复控件替换viewpanel 但是,部分功能是有一个UI方面允许用户选择某些字段(对应于视图),并且只显示匹配的文档。视图正在执行一个过滤器,允许用户选择视图的各个方面来创建搜索(代码正在搜索视图),允许使用搜索结果更新视图面板。

其中一个令人好奇的事情是,viewpanel的值为“#{javascript:view2}”,而不是实际的视图名称。

viewpanel定义了搜索视图和...

我希望能够将相同的功能应用于重复控件。我没有在重复控制上看到那些属性......任何指针?自从我使用xpages已经有一段时间......我已经忘记了很多......

TIA!

3 个答案:

答案 0 :(得分:0)

Read this blog post I did a while back, it should explain what you need.

The view panel doesn't filter anything, it just displays rows from a datasource, same as a repeat control. Indeed you can add components to a ViewPanel's column, pulling from the current row by adding a var property to the dominoView datasource.

The view is bound to #{javascript:view2} (which would be better done by binding to #{view2} - there's no need to call SSJS here). view2 is a dominoView datasource somewhere on your page. The datasource is a wrapper that has properties to capture the settings for filtering and searching that you want to do. At runtime, they are calculated and changes the ViewEntries in the datasource.

Finally there's is the underlying Domino View object available also to LotusScript. This holds and will always hold all entries. The dominoView datasource queries that using the filtering and searching properties and retrieves a ViewEntryCollection or a ViewNavigator.

So whether you use a View Panel, Repeat Control, Data View or whatever else, those are just components to visually represent a collection of ViewEntries or Documents. All can be bound to a dominoView datasource. Where repeat controls and Data Views give you extra power is you can bind them to any kind of collection, not just a dominoView datasource (e.g. DocumentCollection, ViewEntryCollection, multi-value field, Java collection, etc).

答案 1 :(得分:0)

我经常发现在Java中进行搜索,然后将结果作为List更好地传递给repeat,并允许更多选项。我可以在Java中获取所需的所有信息并将其加载到Map或Tree中。这使我能够在Java类中进行自定义排序,并且还可以轻松地组合来自其他视图/数据库的数据。由于数据现在在内存中,因此可以快速重新加载。您唯一需要注意的是数据的大小。如果您有一个包含许多条目(10K?)的视图,您可能不希望将所有内容加载到内存中...

霍华德

答案 2 :(得分:0)

我不确定你是否找到了解决方案,但考虑使用jQuery dataTables。 Oliver Busse写了一篇非常detailed blog post about integrating dataTables into XPages

为了获得特定的格式,我使用了一个重复控件来包含他的博客文章中列出的“td”,“tr”和“thead”属性。