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

Jan 14, 2016, 6:29 AM
4 Posts

Cannot sort columns in a viewPanel with dynamic view

  • Category: Server Side JavaScript
  • Platform: Windows
  • Release: 9.0.1
  • Role: Developer
  • Tags: viewPanel,sortable
  • Replies: 4

Hi all!

I have a viewPanel where the view name to render is stored in a sessionScope variable.

For instance:

            <xp:viewPanel rows="30" id="view1"
                cellpadding="0" cellspacing="0" var="viewEntry">
                    <xp:dominoView var="dynamicView"


Everything works good.

The view has some sortable columns, but, in the viewColumnHeader the element the "Sortable" flag is disabled.
Even if I enable it in the source (sortable="true") I cannot sort the column.

The only way to do that Is assigning a specific view to the viewPanel control. So the sortable flag is enabled, I can check it and sort entries on the browser. But my need is to get a dynamic viewPanel (I man that the "viewName" could be different based on user's choice).

Is there a way to get this working?

I only thought about creating column headers outside the view: a simple table with links in each cell that set some variables in the sessionScope: view column and sorting asc/desc, then on page load moving this table inside the view (before the <tbody>). In the "data" properties of the viewPanel I will get sortable column and order from the scoped variables, this could do the job.
But, since pagination refreshes the view content partially it would only work at first load, right?

By the way I'm sure there's a better way to do that. Surely repeat control (but I have to build the table manually), I hope there would be a better way.

Thank you in advance.

Jan 14, 2016, 4:37 PM
453 Posts
I would use a repeat control

but then that is about all I ever use. You can use just about any type of a collection to create the repeat so doing all of the sorting and selecting up front then load that into say a viewScope variable and make that the source of you repeat. This can be any type of an ordered list. I have stored a list of UNIDs in a viewScope and this works pretty well. I have been surprised at how fast the whole process actual works. I suppose that there could be issues if your selection contains thousands of documents, but I have tested it with about 15,000 and the performance was fully acceptable.

Jan 15, 2016, 6:10 AM
4 Posts
Thank you

Hello Bill

Ok for the repeat control. Sure it will do the job. The ViewPanel would have been much convenient.

Jan 15, 2016, 10:27 AM
589 Posts

The View Panel is only "convenient" IF you don't want to do ANYTHING other then the basics.  If you just want to slap it on, and be happy then great use it.  As soon as you say to yourself "I'd like to do this..." then you're typically better off going to a repeat control rather then fighting the View Control.


Just my opinion.

Jan 15, 2016, 12:29 PM
453 Posts
As David Says

I fought with the view panel for a long time but could not really get it to do what I wanted it to do. Categorizing a 'view' is a real pain in the butt. The first couple repeat controls were a bit of a challenge but then I developed some templates that made the whole process much easier. With a bit of work I standardized a few JavaScript routines for that sorts and returns different types of collections. Yes that took some time, but the frustration with the view panel and the standard methods of dealing with them where seriously hampering getting the job done. As David says the view panel works if that is all you really want, but move one step beyond and it gets pretty ugly.



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