203 Lotus blogs updated hourly. Who will post next? Home | Blogs | Search | About 
 
Latest 7 Posts
XPages Tip: Adding a Bootstrap Class to All Labels via the Theme (Redux)
Wed, Jul 20th 2016 4
XPages Tip: Overriding, Concatenating, and Conditionally Adding Control Properties via a Theme
Wed, Jul 20th 2016 8
XPages Tip: Displaying Bootstrap Applications Properly on Mobile Devices
Tue, May 31st 2016 3
Efficiently Keeping an XPages Session Alive with JSON RPC
Wed, May 25th 2016 3
Browser Session Lifespan – Idle Session Timeout vs LTPA Token Expiration
Tue, May 24th 2016 3
XPages Tip: Passing an Array to a Custom Control Property
Tue, Apr 12th 2016 3
XPages Tip: Beware Server-Side code in Multiple onClientLoad Events
Thu, Apr 7th 2016 5
Top 10
Implementing Font Awesome 4.0.3 in XPages
Mon, Apr 7th 2014 12
Gridx in XPages – Creating a Simple Grid
Thu, Nov 6th 2014 11
Gridx in XPages – 4: Loading Live Data via a REST Service
Mon, Nov 10th 2014 11
Adding Event Handlers to Font Awesome Icons in XPages
Wed, Apr 9th 2014 10
Dojo in XPages – 20: Handling Successful or Failed AJAX Requests
Wed, Apr 23rd 2014 10
Computing Custom Date Format Patterns Throughout an Application
Mon, Aug 18th 2014 9
XPages Tip: Fixing a partial refresh issue with the Pager Add Rows control in a Data View
Mon, Aug 25th 2014 9
Initializing Global Variables and Synchronous AJAX Calls in an Angular XPages Application
Thu, Oct 30th 2014 9
Dojo in XPages – 22: Displaying an Image Gallery of Attachments
Thu, May 8th 2014 8
Gridx in XPages – 18: Formatting Date and Currency Columns
Thu, Dec 18th 2014 8


XPages Tip: Filtering a View Data Source with URL Parameters
Twitter Google+ Facebook LinkedIn Addthis Email Gmail Flipboard Reddit Tumblr WhatsApp StumbleUpon Yammer Evernote Delicious
Brad Balassaitis    

If you’re looking for a quick way to manipulate the data returned by a view data source, you can use URL parameters that match the property names. This allows you to effectively compute them without having to write code to compute the parameters. In this post, I’ll show several examples.

Sample View

In my sample database, I have a categorized view in the Notes client.

ViewDataSourceURLParams-1

I added a data source for this view to an XPages and dragged all of the columns on to the page to have it automatically create a view
panel.

http://www.server.com/myDB.nsf/MyPageName.xsp
ViewDataSourceURLParams-1b-XPage

Here’s the data source tag on the page — there are no computed properties.

<xp:this.data>
  <xp:dominoView var="view1" viewName="People"></xp:dominoView>
</xp:this.data>

Using URL Parameters to Filter the View

To filter the view, all you have to do is append URL parameters with the same name as a filtering property of the view data source.

To limit the data to a single category, add a categoryFilter parameter.

http://www.server.com/myDB.nsf/MyPageName.xsp?categoryFilter=Group 1
ViewDataSourceURLParams-2-categoryFilter

To execute a full-text search, add a search parameter. (The database must be full-text indexed or it will throw an error.) You can also include wildcards in the search parameter.

http://www.server.com/myDB.nsf/MyPageName.xsp?search=101
ViewDataSourceURLParams-3-Search

To filter the results based on the first sorted column in the view, use the keys parameter.

http://www.server.com/myDB.nsf/MyPageName.xsp?keys=Group 3

Other Actions

To set the view’s starting point, you can use the startKeys parameter. (Note: The view will continue on to the end after the starting point.)

http://www.server.com/myDB.nsf/MyPageName.xsp?startKeys=group 2

To expand or collapse categories in the view, use the expandLevel parameter.

http://www.server.com/myDB.nsf/MyPageName.xsp?expandLevel=1
ViewDataSourceURLParams-4-ExpandLevel

Miscellaneous Notes

These attributes work on the view data source and not specifically on the view panel, so it is useful on a repeat control or any other control that uses a view data source.

If your data source has ignoreRequestParameters set to true, then this will not work because it will – um – ignore the request parameters.

If you enter a parameter that doesn’t correspond exactly to a property name, then it will be ignored by the view data source.




---------------------
http://xcellerant.net/2014/07/07/filtering-a-view-data-source-with-url-parameters/
Jul 07, 2014
5 hits



Recent Blog Posts




Created and Maintained by Yancy Lent - About - Planet Lotus Blog - Advertising - Mobile Edition