logo

Domino JSViewLister

Charles F. Philips sent me a demo database yesterday that I liked so much I've decided to host it here and share with you all, thus giving it the highly coveted CodeStore Seal of Approval.

It's called JSViewLister and uses AJAX to reproduce Domino views cross browser. The beauty of Charles' code is that it works with multi-level categorised views and also fetches the view's design so it knows all about the column titles etc. Take a look. If you like it you can download it here.

It was interesting for me to look at as it's something I want to tackle myself when I find the time. First though I want to spend some time learning JavaScript for real. While I know a lot about JavaScript there's also a hell of a lot I don't know. To start I am going to watch all four parts of Doug Crockford's (invented JSON) "The JavaScript Programming Language" presentation and then read at least the first few chapters of the rhinoceros book.

As he says, JavaScript is "The world's most misunderstood programming language".

It feels to me that JavaScript is really coming to the fore right now and being taken a lot more seriously. Using what's available now we can start making some "plugins" for Domino to make the browser experience much more palatable.

Comments

  1. Yep - after hacking about for a while I finally bought the Rhinoceros book and it's very good.

    Another book I could recommend is Langridge's "DHTML Utopia - Modern web design using javascript & DOM".

    However, when it came to really beginning to understand the internals & what happens when code is executed, then the following link on closures is really good - a mist lifted when I read through and understood this:

    {Link}

  2. Javascript is definitely on the rise. Until recently, it was little used and much abused, but Ajax and "Web 2.0" in general have brought to light how much power it truly has. What's encouraging to see is how much emphasis is now being given to appropriate browser detection and graceful degradation; in large part, Javascript's poor reputation in the past was a result of a tendency for developers to neglect these considerations.

  3. Nice example, I haven't seen many dynamic view implementations on the web that deal with categories. I made a couple of tweaks to the JS to fix the plus/minus display. One was innerText to innerHTML so that firefox will actually change when clicked, the other was a little bit of code when generating the table to set the default plus/minus based off of whether its expandAll or not.

    {Link}

    • avatar
    • noon
    • Tue 30 Jan 2007 09:49 AM

    Hi,

    Thanks, nice example.

    The thing is, that I don't quite understand what so 'cool' in rendering notes view's by JavaScript / AJAX combination (or with some other techniques). What's "wrong" with the domino way to render the html data to browser? Is this just a personal problem or have I missed something during the time? :)

    Is it faster to use JS & AJAX or... ?

    Otherwise I love JavaScript and I love AJAX everytime more and more when I find something new to it with, especially when I use it with Domino.

    • avatar
    • Luc
    • Tue 30 Jan 2007 09:52 AM

    I really liked this. However, I am trying to make it work for IE 7...it shows all undefined...am I doing something wrong? I tried the same in Firefox and it works great.

  4. noon,

    Domino's rendering of the views causes a postback every time you click on a category - I find it to be abhorrent. Even worse, you can only have one category open at a time unless you expand all. Many of our customers complained and requested that we make the views allow more than one category open at once.

    • avatar
    • Fabio
    • Tue 30 Jan 2007 10:14 AM

    Hi Charles F. Philips

    it's good.

    but unfortunately you read all documents immediately.

    This example read only the open node.

    {Link}

    tks

    Fabio

  5. Luc,

    I tested in IE6 - None of our customers use IE7, so I stick with what they use. Sorry, but I'll have to revisit that one later. If you find what it's tripping up on, please let us know.

    Actually, it just occured to me that it might be that IE now uses the textContent property like Gecko browsers do and not the text property. If so, it will need to be modified to test IE versions...

    • avatar
    • Bjorn Cintra
    • Tue 30 Jan 2007 10:18 AM

    Luc: You are right, there is an error using IE7

    noon: What is wrong with the domino way is the lack of control on the result, especially with categorized views

    What is currently missing to do really great designs in Domino is to tame the views :)

    However a more ideal solution than this one would be one that dynamically loads the categories when a user expands them, instead of loading the full xml file.

    As Jake, this is something I would like to tackle once I have time.

  6. One question. Does it support breaking a big view in pages? I'm asking because I have 2 independent implementation of domino view using AJAX (first one using Dojo Tree Widget and second one with a custom made script) and I find that dealing with pages is quite painful

  7. This is pretty interesting. Problem, though - I opened the JSViewLister form in Designer, and there's nothing in the JSHeader, even though the About page indicates that most of the code should be in there. The onLoad event is calling a function called makeRequest, but I can't find that function defined anywhere. I'm running 6.5.3. Am I looking in the wrong place?

  8. OK, sorry for posting that too soon; just found the script library and the fact that it's referenced in a computed field on the StandardFields subform. That'll teach me to rely on the About document... :o)

  9. Fabio/Bjorn,

    I tried to do exactly that (the agent I used to use did it), but for some reason, I could NOT get ?ReadViewEntries to return subcategories using RestrictToCategory; only top level categories.

    Egor,

    Sorry, but I never even gave that any thought - I only meant for this to be used with small and medium size views, particularly since it is curfrently loading the entire view at once.

    My first priority is to fix the IE7 issue when I get home this evening.

    • avatar
    • Luc
    • Tue 30 Jan 2007 10:36 AM

    Esther...it should be a JS Library with the source code.

    Also, the subform with common fields makes the call to the source code.

    • avatar
    • Luc
    • Tue 30 Jan 2007 10:43 AM

    Thanks Charlie, if I come across the fix of that issue I will let you guys know...

  10. Esther,

    The About doc was correct when I submitted the database.

  11. All,

    I was quite embarrassed to realize that it bombed under IE 7. As soon as I got home I installed IE 7 and I've fixed it - it was not node.textContent as I suspected (they still follow their own "standard" with node.text), but instead they now have it honor the xmlHTTPRequest object instead of ActiveX. Sooooo, Now I have to test for object usage and THEN version test for IE7. It's that or try to version test for ALL browsers and that's just way too many things to go wrong.

    I also saw that the pluses and minuses were all buggered up - it was initializing with plus signs even if it started out fully expanded. Also, it wouldn't change when clicked in Firefox - that's because Firefox doesn't honor innerText, but it does honor innerHTML, so I've fixed all of that (except that Firefox doesn't honor the 11px width).

    I've sent the new version to Jake to be posted, but since he lives in England, it's about 4 am for him as I write this. Let's give him tme to wake up and smell the coffee, eh?

    Thanks for all of your kind comments folks! If you see anything else I've overlooked, please let me know.

    Thanks,

    Charlie

    • avatar
    • ethel
    • Wed 31 Jan 2007 02:08 AM

    That has to be one of the most boring presentations on javascript i've ever seen - i think I'll go and stick my head in the oven now.

    • avatar
    • Luc
    • Wed 31 Jan 2007 08:04 AM

    Thanks Charlie, looking forward to trying that updated feature.

    • avatar
    • Jake Howlett
    • Wed 31 Jan 2007 04:21 PM

    Online demo and download updated now.

    • avatar
    • lamon
    • Wed 31 Jan 2007 11:29 PM

    very good,thx jake.I download the demo and found a problem:when I add the third Category,there's an error.

    • avatar
    • Stuart
    • Thu 1 Feb 2007 05:25 AM

    Thanks for this Jake/Charles. I'm not sure why but a few views I've been testing this on have been throwing out an 'element has no properties' error in the getText() function. Wrapping a try/catch round the code fixes this.

    • avatar
    • Rho
    • Thu 1 Feb 2007 05:56 AM

    thanks but too many limits.

    if you know xsl this it is a truly simple and complete example. {Link}

    what do you think? Charlie

    R

    • avatar
    • Mark Vincenzes
    • Thu 1 Feb 2007 07:26 AM

    Jake, thanks for the link to Doug Crockford's JavaScript videos. Interesting watching while I'm nursing my post- Lotusphere cold.

  12. Very nice work. Like it a lot. But aren't we still limited to views with less than 1001 documents? I mean, it is still based on ?readviewentries isn't it?

    regards

    Steen AA

  13. lamon: Can you give me specifics about the third category you added? I just added more categories and it worked fine for me.

    Stuart: I hadn't run into that yet - thanks for the tip!

    Rho: I've tried twice to see Fabio's version, but our proxy is blocking it. I normally have no problem downloading zip files, so I think it might be the funky way .NET is forming the link. I'll try to remember to check it out at home tonight.

    Steen: You are correct, but until I get this only loading categories as needed instead of the entire view at once, I wouldn't use this for large views anyway.

    All: Thanks for bugtesting - it keeps me honest and you've all been a great help improving the product!

    Cheers,

    Charlie

    • avatar
    • Stuart
    • Thu 1 Feb 2007 09:36 AM

    Charlie - a little further digging around into my problem. Some of my views have a Null value in a column. The getText function will either break or return a value of 'undefined' if the try/catch has been wrapped around it. So need to trap Null value columns.

    • avatar
    • Stuart
    • Thu 1 Feb 2007 09:47 AM

    Charlie - one last thing with regard to null value column. This is also caused by a column that has 'show responses only' checked (response=true in the ?readdesign xml) and there are no response documents.

  14. Fabio & Rho,

    treeAjax is a VERY nice looking implementation. However, it appears to be Microsoft only. Please correct me if I'm wrong, but that negates the original concept - I'm trying to build something that adheres to current web standards as much as possible and as many different browsers as my poor addled brain can handle.

    Thanks anyway,

    Charlie

    • avatar
    • lamon
    • Thu 1 Feb 2007 11:52 PM

    Charlie: I make some mistakes about more categories.It's good.

    And I have another question,the views have many docs,and I want to display 20 docs per pages,and I noticed that the jsviewlister not support multi pages display.

  15. Charlie:

    unfortunately it is alone microsoft.

    thanks for your observation.

    You are a good developer.

    Thanks

    Fabio

  16. lamon,

    That is a tough one. It raises the question of where to break it up? In order to function, the separation will have to fall between top-level categories. So, will the subcategories and documents inside of each top-level category count? If not, then you could limit each "page" to 20 categories, but once opened, it could still be huge. If yes, then you would most likely have a different number of top-level categories on each page and it would never really work out to exactly 20 entries.

    UNLESS... What if instead of using the spans as containers for its children, each entry were an independent span/line sharing the same id as its siblings and clicking a "+/-" would get a collection of the siblings and show/hide the entire group? That would not be pretty coding (!), but it might be made to work.

    Currently, I am more concerned with properly handling child documents and with storing the opened categories in the session so that the user will return and see the view as he/she left it last. Are you interested in trying to make the above idea (or one of your own) work?

    R/s,

    Charlie

    Work is the curse of the drinking classes.

    ---Oscar Wilde

  17. Great example - This is exactly what I am trying to accomplish on a new site I'm developing.

    I wonder if anyone has modified the code to work with a single-category view?

    I have a couple of categorized columns under a primary categorized column, and would like to restrict the displayed information to a single primary category.

    I have played with the XMLHttpRequest URL (added the "RestrictToCategory" parameter), but that renders some pretty strange results.

    I'm pretty sure it is a matter of modifying the "processDesign" function to disregard the primary category column title (well, that's my first guess!), but wondering if anyone can confirm if I am on the right track or way off base.

    Thanks in advance to anyone who may be able to assist!

    T.

  18. Has anyone had any issues/experience with using this method to access documents that have reader fields? From what I can tell it has problems if you introduce access control at the document level

  19. One additional piece of information. I think this has something to do with the placeholder not matching up with the entries.length when you have documents which are excluded due to Reader fields. Is that possible or am I totally off base?

    This solution will work great if I can get past this....

  20. I posted about this issue on another article.

    I modified JSViewLister into an Ajax menu.

    I changed the view to only one category, modified the main form and took the automated link out of the JavaScript doc.

    It works great in IE 7 & Mozilla on my PC, and also with Mozilla on Mac.

    However when I test it using Safari it returns 'undefined'.

    Does Safari know Ajax?

  21. Hi,

    How can I change openEntry() or openDocument() to open in a new Window ??

    P.S. I think this jsviewlister is very easy to use and its documentation is written very well so that we can understand it quickly. Thanks so much.

    Cheers,

    Anthony

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment:


About This Page

Written by Jake Howlett on Tue 30 Jan 2007

Share This Page

# ( ) '

Comments

The most recent comments added:

Skip to the comments or add your own.

You can subscribe to an individual RSS feed of comments on this entry.

Let's Get Social


About This Website

CodeStore is all about web development. Concentrating on Lotus Domino, ASP.NET, Flex, SharePoint and all things internet.

Your host is Jake Howlett who runs his own web development company called Rockall Design and is always on the lookout for new and interesting work to do.

You can find me on Twitter and on Linked In.

Read more about this site »

Elsewhere

Here are the external links posted on the same day.

More links are available in the archive »

More Content