I’m trying to make some real-world application stuff with xpages. I have a xpage with a view control on it. The underlying view has the first column categorized.
Now I want to filter the embedded view on the xpage by a specific category, just like it was possible with the &restrictToCategory URL parameter in classic Notes.
I searched through the documentation and designer wiki, but did not find anything about that… so, how do I filter the data a view control displays?
Apart for setting the view data source filter properties statically or dynamically via script, if you want to do a quick test you can just append these filters as parameters in a URL
There are two examples below. The results would be 100% consistent with filtering views using the Java backend classes,
i.e. if you wrote a Java agent in the client to filter this view using view.createViewNavFromCategory(“DAOS”) you would get the same results
– likewise for view.getAllEntriesByKey(“DAOS”, false);
The behaviour of the backend APIs govern what the filter produces.
Subject: Dynamic key filtering hooked to a search field
I keep looking for a way to do the following.
In an Xpage have a view and a search box. As the user types data in the search box the view dynamically subsets with each character typed - so if there are 100 names and 5 start with a, when the user types an ‘A’ then the user only sees the five that start with ‘A.’ It seems this is close to what I want to do.
You need to work with the onKeyUp event of an edit box.
I’ve done this by setting the ‘search’ property of the view show everything if the edit box is blank. If not blank, it should search for what is in the view.
I have made this dynamic by adding a “*” to the front and back of the edit box contents and using @ReplaceSubset to replace " " with " OR ".
First of all there is nothing new about filtering views using Keys or categoryFilter in Notes/Domino - they use Java backend API which have been there for the 10 years or so. What’s new is how they’re implemented in XPages as it’s new itself.
Both these filtering methods need a Notes view to work from and this view needs some of the columns to sorted.
For Keys, the view will return all those documents which begin with that key. You can narrow this search down by using the ‘keysExactMatch’ property which will return the documents that match exaclty the key.
For categoryFilter, what is returned is all documents which match that Notes view category.
This is a real short explanation and I will be writing up a wiki doc to explain this further.
filtering a view by keys is a very nice feature.Unfortunately, it does not work with sortable columns:
create a view with the first column sorted
second column is sortable by user
Embed the view in the xpage, filter by a key on the first column.
Select the “sortable” propertie in the column header of the embedded view in the xpage.
Result: after opening the xpage the view is sorted by the key as expected. The user can click on the column header of the second column in order to sort it.
After that, the view displays no data anymore.
So that means you only can filter a view which is not sortable by other columns.
And that means this feature is quite limited for real world applications.
This is a bug, but I’m seeing the data from the filtered view disappear when I select the sortable column header. Could you provide more information on the use case you’re using?
Subject: Couldn’t that be inherent to the way Notes views work?
I assume that the behaviour described is very similar to what we can observe in classic Domino views since we got user sortable columns: think of a categorized view that is re-sorted by another column. What happens is that the view looses its categorization (thus becoming worthless in many cases…). Reason is that the user-sortable column now takes over as the sole sorting order for the entire view. A positive effect is that now we can perform a quick search on the view where the search key which normally only would work on the first visible column now works on the re-sorted one.So I assume that the XPage key filter must be effective for the first / main sorted column of the view. Which might be the user-sortable column…