I am trying to bind any one of a number of views on a xPage Control. The view is based on a URL param, but I am having trouble trying to access the URL params. I am guessing it is a scope issue, but I can’t not figure out how to achieve.
For instance, in the Data Binding → View Name Computed Formula, I have:
var compViewName = “view1”
var sessViewName = “view2”
var courseViewName = “view3”
var CN = context.getUrlParameter(“CN”)
if (CN == “session”){
viewName = sessViewName;
return viewName
} else{
viewName = compViewName;
return viewName
}
I am assume that I am missing something basic.
Thanks,
Shawn
Subject: Solved. Is this a BUG?
I finally had time to track this down and was using a workaround in the mean time.
Here is the problem: when you open a document (that is set to launch via xPage by the Form property, any querystring information is not getting passed to the Xpage even though it does appear in the browser’s address bar? This was driving me crazy but finally found out why when I started analyzing the queryString in more detail.
So, if I open a document using the following, the QS is not available to the xPage but does appear the the browser’s URL:
“./0/” + doc.getUniversalID()+ “?Open&” urlParms
If I change the url to the following, the QS parameters are now available on the xPage:
“./xpAttachments.xsp?documentId=” + doc.getUniversalID()+ “&action=openDocument&” + urlParms
Subject: This didn’t used to be possible…
-
Used to be Lotus would let you compute the View, but the viewPanel couldn’t use that information, because the viewColumn markup is static. I suppose if you had multiple Views with exactly the same column names it could work.
-
Best way I know of to do multiple Views with one control is to roll your own. Dec’s XPages blog has an excellent starting point for that. Sadly I know of no easy way to do categorized Views using the “roll your own” method, and haven’t been able to find hints for same anywhere here, on the web, or via PMR.
-
In short viewPanel appears to be shockingly limited, about to the point of utter uselessness. I’d love nothing more than for someone to prove me wrong, because then I’d know.
Your mileage may vary…
Subject: view binding
Thanks for your response, however, I am not trying to use this in a view panel.
I am trying to bind in a custom control, but maybe there is the same limitation in the scope that the formula is executed.
My Formula works in that it is executing to the else statement because the URL parameter is not retrieved.
It seems that there would have to be a way to access a URL parameter, session scope var, etc that I can use to programmaticaly bind the view.