PermaLink How Domino Should Integrate AJAX10/02/2006 01:38 PM
After watching a recent September IBM webcast on Using AJAX With Domino Applications, I can't help but wonder why Domino isn't adapting AJAX at a much higher level.  I've been doing too much ASP.Net 2.0 work lately and enjoying the use of the Anthem.Net library.

Anthem.Net is much easier to use than even Microsoft's own Atlas library and it follows the 90% rule (make stuff easy for 90% of the applications but allow the other 10% to be programmed w/ helpful APIs). Atlas in comparison seems to take the other approach where they expect 90% of their users to be using the APIs that can make AJAX dance and is a lot harder to set up and use (but I assume they'll be adding wizards and installation helpers to make this a moot point soon).

Anthem.Net conceptually does this for the 90% of users:
- you add Anthem support by declaring the library in your ASPX page
- you add Anthem panels on which you can add non-Anthem controls or, without the panel, you use Anthem controls which are AJAX enabled
- when you handle the various events of the controls (onClick, etc.), you can declare which controls should be updated

For the other 10% of users, you can call AJAX enabled APIs in your application and return multiple datasets. You can then use the standard Javascript DOM to update your web UI in the browser. Note that you don't muck w/ making your own XMLHttpRequests (the low level AJAX calling method) which is good because most people just care about making calls to the server and returning data.

Domino's object oriented form model can adopt this model for AJAX support easily, and also include the Dojo AJAX library for the 10% of users who want raw APIs. For the form, add a new "use AJAX" checkbox like the "use Javascript" checkbox that was added in R5. Domino treats fields as objects already, so you can program field event handling for the Notes client or web brower; I'd propose that there be an additonal AJAX mode in the pulldown for some field events (e.g., onChange or onClick). Each field should also have an AJAXUpdate property (or UpdateAfterCallback as Anthem names it) that will send the HTML representation of that field back as a result of this AJAX call. E.g., you can then update various parts of the UI using a simple Lotuscript AJAX handler for a checkbox that a web user checks off if they went to graduate school so that person has a field the user can fill in:
WentToGradSchool field's onClick event (AJAX)
  GradSchool.Visible = true    ' make GradSchool text field visible
  GradSchool.ClientValidationEnabled = true
  GradSchool.AJAXUpdate = true
When the AJAX callback comes back, it will make the hidden GradSchool field visible and enable client-side validation for that field to make sure it's filled in; the field can also have typeahead AJAX lookups of grad school names. There should also be properties that let you change the CSS style of a field as part of the AJAX callback so you can do stuff like highlight a field that has errors.

Domino needs to add a new "container" field that is basically a DIV or SPAN that we can control CSS Styles on. The tabbed UI done w/ table rows is something on the lines of this, but we need more control of the look and visibility, positioning, etc. during the AJAX callback.

We need to be able to declare functions as AJAX callbacks like Anthem does. Again, Domino's object oriented form approach makes this simple because we can declare functions that are part of the form. The functions need the context of the current form the user is editing and this can be handled similarly to how Agents have a DocumentContext. Agents should be able to be AJAX called as well. We also need simple ways of returning multiple datasets via one AJAX call, e.g.:
  Dim result(3) as new AJAXDataSet(3)
  result(0).TableName = "Status"
  Dim row as new AJAXDataRow(2)
  result(0).rows(0) = "Region1"
  result(0).rows(1) = "200"

And finally, let us handle views using AJAX (again views need more DIV/ID tags so we can control the markup and CSS styles of the view). We should be able to hook into the "expand" event of each category so we can do things like lazy loading of data. We should be able to hook into column click events and paging events so we can do simple stuff like hiding the next/prev buttons if you're at the first/last page of a view. Even the default Notes view should be able to handle lazy loading.

The Dojo toolkit provides a lot more AJAX enabled controls (e.g., time selector, date picker, dynamically updating combo box, etc.) that Domino can make use of. Here's hoping Domino R8 (R7 was a Notes client update, but R8 will be a big server update) will take advantage of AJAX and make it easier for Domino users to do Web 2.0 apps...

Comments :v
No comments.

Start Pages
RSS News Feed RSS Comments Feed CoComment Integrated
The BlogRoll
June 2024
Contact Me
About Ken
Full-stack developer (consultant) working with .Net, Java, Android, Javascript (jQuery, Meteor.js, AngularJS), Lotus Domino