Search DominoPower's 11,443 Lotus-related article archive 
Home
EasyPrint
News details Click here for the RSS feed's XML code. This is not a browser URL.
Articles-only Click here for the RSS feed's XML code. This is not a browser URL.
Twitter Feed Click here for the Twitter feed.
PROGRAMMING POWER
Sorting your Domino views with JavaScript
By Colin Neale

Have you ever wanted to be able to sort your Domino views in the browser in just the same way that you can from the Notes Client? This article shows one way to achieve column sorting on the Web using some simple JavaScript routines. I use a similar method to allow the sorting of search results in my C-Search products.

Create a simple database
I started by creating a database. I added a form and two fields: "Title" and "Author". Next I added some sample documents. Figure A shows these documents when viewed from the Notes Client.

FIGURE A


Here's a simple database contents viewed in Notes. Roll over picture for a larger image.

Here sorting is achieved by clicking on each column header. I will now show you how to reproduce this same functionality in the browser.

Create a Web view
I proceeded to create a view for the browser. I used multiple columns to make the code easier to follow but you could group all of the HTML into a single column if you prefer. Each column in my Web view is detailed below. The Column-1 formula is simple:

Title

Set to sorted ascending and hidden because we don't want the browser to see it. The Column-2 formula has some table tags:

"<tr title=\"row\">"

This defines the start of each table row. Note that I have given the row a "title" attribute. I use title attributes of the "tr" and "td" tags to give me access to the data that I want to sort on.

The Column-3 formula is where some of the hard work begins:

_db := "/" + @ReplaceSubstring(@Subset(@DbName;-1);"\\";"/");
_url := _db + "/0/" + @Text(@DocumentUniqueID) + "?OpenDocument";
"<td width=\"50%\" title=\"booktitle\" abbr=\"" + @UpperCase(Title) + "\"><a href =\"" + _url + "\">" + Title + "</a></td>"

This is the first column of the HTML table. It displays the book titles as links. Note, that I use the "title" attribute of the "td" tag here just as I did for the "tr" tag above. For the table columns however I also use the "abbr" attribute to hold the value that I wish to sort by.

Column-4 formula adds a bit more:

"<td width=\"20%\" title=\"author\" abbr=\"" + @UpperCase(Author) + "\">" + Author + "</td>"


1  ·  2  ·  3  ·  Next »
Other articles you might like
Home > Internet Technologies > JavaScript (13 articles)
   Give your Domino views life with DHTML
   Using dynamically generated HTML to thwart spam email address harvesting
   Implementing dynamic drop-down menus using Domino and Internet Explorer
Home > Lotus Technologies > Domino (77 articles)
   More about Domino log files
   Why your log.nsf might not be purging properly
   Sloppy analysis at the core of another Domino vs. SharePoint report
Get Weekly Email Updates
Subscribe to our regular weekly email newsletter. It's packed with tips, reviews, deep analysis, and the latest news.
 
Recent DominoPower Articles
Syncing Notes with Android phones
Application development, William Shatner, and the origin of the universe
Learn Domino Designer 8.5 for free
The (near) future of Sametime, Quickr, Connections, and Symphony
Inside the IBM Innovations lab
Lotusphere 2010: Hot fixes and cool news for Notes, Domino, and LotusLive
Lotusphere 2010: mobility and collaboration
Latest Lotus Headlines
Xpages not loading? JVM errors? - Solution
How to implement an iCalendar feed into your Notes calendar with XPages
DWA Hotfixes for Domino 8.5.1FP1 - A Gotcha
IBM Adds DB2 to Lotus Foundations SMB Package
SNTT : XPages onclick Ghosts in the machine
Ports used by Lotus Sametime 8.5 servers
Exploring a Domino Date Bug
>> Read all the news
More from the ZATZ journals
Computing Unplugged: Online safety for virtual learning
David Gewirtz Online: CNN commentary and analysis
OutlookPower: Seek and find: Strategies to locate filed-away emails fast
-- Advertisement --

Find unused Lotus Notes groups and clean up your address book
Have you ever wanted to get rid of old Lotus Notes groups that were cluttering up your address book, but you weren't sure if they were used? Find Unused Groups can help.

Find Unused Groups will check your ACL, mail, multi purpose and server groups to help you determine if they are used, and who uses them.

Learn how to easily clean up your address book.

-- Advertisement --

Struggling with exporting Notes data to spreadsheets? No More!
Try IntelliPRINT, The world's leading Reporting, Dashboards, and Analysis solution for Notes & Domino

  • Don't spend unproductive time maintaining different versions of the same spreadsheet
  • Preserve data integrity and security in multi-user environments
  • Create reports in minutes INSIDE Notes
  • Get freedom from iterative report requests, deliver self-serve capabilities

Experience Reporting, Dashboards, and Analysis INSIDE Notes.

Try IntelliPRINT NOW!

ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2010, ZATZ Publishing. All rights reserved worldwide.
Editor's Login