This forum is closed to new posts and responses. New discussions are now taking place in the IBM Developer Answers forum.

Jan 5, 2016, 11:02 AM
68 Posts

Sorting a filtered view control?

  • Category: Other
  • Platform: Windows
  • Release: 8.5.3
  • Role: Developer
  • Tags:
  • Replies: 4

There's a known limitation in an xPages view control:  if you filter the view, sortable columns become non-sortable (the sort icons disappear).  Is there a fix for this, or a workaround?

Here's the scenario ... I have a filtered view of actions called "my open actions" that is filtered by each user's name, so they only see their actions on this xPage.  They want me to add a sortable column, so they can see which ones they edited first/last.  Adding a sorted column in the view is easy, but how do I make the sort functionality visible in the view control on the xPage?


Jan 5, 2016, 1:22 PM
453 Posts
some Thoughts...

I do something along this line in a couple different ways.

First, I have an aversion to the view control because it simply does not give me the control I want.

Second I love the repeat control as I have found that I can do almost anything with it.

In this regard I did a show for Dave on NotesIn9 where I build a categorized repeat control structure. does not do everything you are looking for but a start. You can see the video at and download the full function database used in the video from 

In another instance I use a view full text search to get a collection of documents then feed them into a repeat control:

var n:Integer = vw.FTSearchSorted(query, maxReturn , column, sortOrder, exactCase, variants, fuzzy);

Note this method returns the number of found documents to now are working with the view and need to manipulate it into dataSource for the repeat control.

in your case I would start by calling a dialog where the user would select the "column" to sort by from a drop down. Note columns in view must be sortable.

The query would be something like "Originator =" + UserName 

Then using the returned vw feed that to the repeat, how you do that will depend on how you need the data to display. I tend to create a collection of UNIDs and store that in a viewScope or sessionScope variable (could do all this as part of a viewScope or sessionScope managed Bean) then let the display in the repeat get the actual documents. Understanding that this does create a more processor and network traffic intensive application but I have tested this with some 10000 documents in the return list and the response is very acceptable. Your experience might vary. Besides if you just want this particular users current documents the return is probably fairly same, say a few hundred documents at most.

Hope this helps, 

Jan 5, 2016, 3:30 PM
68 Posts

That's a lot of code!  But it may come in handy someday.

I solved my problem another way - by changing the view selection to only display documents where the Originator = @UserName.  That way, I don't have to filter the view control, and the sort columns work. 

Jan 6, 2016, 11:00 AM
453 Posts
Glad that you were able to get it done.

I still don't like the view control! :-)

Yes there is a fair bit of code behind the process, but then I'm a control freak and can get just about anything I want.

Feb 2, 2016, 9:34 AM
14 Posts
Just to pile on ... I dislike the view control as well.

I happen to like the extension library's view control. Less code to maintain. I do wish it would interpret more of the Notes view's formatting though, with maybe an option switch to turn on more formatting.

I've found using single-category on the view in Notes also shuts off sortable columns, too. I assume it's because the view would sort differently -- that is, the sortable columns are the primary view sorting on the view, so setting alternate view selections would compromise the sort. I'm not sure there's a good answer for that.

In 8.5, I've noticed the column sorting in XPages doesn't work in "both directions". That is, if you tell the column to sort both ascending and descending, the descending sort is garbled. That even happened to me on the extension library's view control. I wish that were fixed.


This forum is closed to new posts and responses. New discussions are now taking place in the IBM Developer Answers forum.