Search DominoPower's 11,441 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.
Sorting your Domino views with JavaScript (continued)

The second table column displays the value in the Author field.

The Column 5 formula ends the table row:

"</tr>"

Finally, I enabled the "Treat view contents as HTML" property and saved the view.

Create a form to show the view through
Next I created a $$ViewTemplateDefault form to display the view created above. I added the following HTML code to the top of the form.

<table border="0" width="100%">
<tr>
<td width="50%"><a href="#" onClick="javascript:sortTable('Title');return true">Title</a></td>
<td width="50%"><a href="#" onClick="javascript:sortTable('Author');return true">Author</a></td>
</tr>
</table>
<hr>

This table consists of one row that has two links. These links are our column headings which when clicked will sort the view by column using the values assigned to the column's "abbr" attrbibute.

Next I added the following:

<span id="contents">
<table width="100%">

On the next line I added the "$$ViewBody" field (this is where Domino will render the view) followed on the next line with the code to close the view table.

</table>
</span>

Notice that the view table is itself wrapped in the span block "contents". It is the "innerHTML" value of this block that is rewritten each time the view contents are sorted.

I then set the Pass-Thru HTML property of all the HTML on the form.

Add the sorting routines
Next, I added the JavaScript to the $$ViewTemplateDefault form. The following code was added to the onLoad event.

var booktitles = getTableElements("td","title","booktitle");
var authors = getTableElements("td","title","author");
var rows = getTableElements("tr","title","row");

for (i=0; i<rows.length; i++){
contents[i] = {booktitle:booktitles[i].getAttribute("abbr"),
author:authors[i].getAttribute("abbr"),
details:"<tr title=row>" + rows[i].innerHTML + "</tr>"
}
}

As the form loads it builds three arrays. The first two "booktitles" and "authors" contain the HTML output from Columns 3 and 4 in our web view. The third array "rows" contains the HTML for each table row in full.

These three arrays are then used to build another array "contents" but in doing so, only the "abbr" values are extracted from the booktitles and authors array elements. The first entry in the contents array "contents[0]" will look something like this once the page loads.


« Previous  ·  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
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
2010: A Lotusphere of change
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: The iPad defenders have spoken
David Gewirtz Online: CNN commentary and analysis
OutlookPower: More about disappearing text
-- 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 --

Integrate your Notes Applications with Microsoft Office and Symphony
Integra for Notes Integrates Microsoft Office and/or IBM Lotus Symphony
Requires NO change to the design of the appliation or Installations of DLL's and EXE's
  • Integra is a ready to use solution, enhance static reports with Excel data analysis, pivot tables, macros
  • User friendly aproach, using a point and click access to features
  • Reports from any Lotus Notes databases
  • Runs reports through a Notes client, web browser and scheduled basis
  • Allows use of LotusScript for advanced data manipulation
  • Enables self service reporting capabilities to end-users


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