|
Comments
|
Today's Top SOA Links
DataWindows A Current Row Indicator for HTML DataWindows
A Current Row Indicator for HTML DataWindows
By: Ido Millett
Jan. 1, 2009 12:00 AM
One of the typical problems developers face when using the HTML DataWindow (HTML DW) is that there's no SetRowFocusIndicator() method to allow users to see which row is the current one. This can confuse the user and lead to errors. For example, without a current row indicator users may not know which row will be deleted when they press a Delete button. This article describes a simple and effective technique for addressing this problem. The Solution The key to the proposed solution is that it avoids the need for a round-trip to the server. It simply uses the RowFocusChanged event to set the text in a Pointer computed column to "<<<" for the current row and to a blank (" ") for all other rows. Changes to the DataWindow Object As demonstrated in Figure 3, you must set the Tab Order for the Pointer column to nonzero because SetItem(), at least in the current version, doesn't work for HTML DW columns with a Tab Order of zero. Since the Pointer computed column contains blank text, and since it has the same background color as the DataWindow, it doesn't show in the DataWindow. This allows you to keep using the same DataWindow object within regular DataWindow controls. This same line of reasoning explains why we place the Pointer column on the right - so we don't have to modify the layout of the existing columns.
Before you save and exit, make sure that the "Client Events" and "Client Scriptable" options are enabled in the "HTML Generation" properties tab for the DataWindow object. These options allow us to use client-side events, such as RowFocusChanged, and client-side methods, such as SetItem(), with the HTML DW control. Also, make sure the "Object Name" property is set to "htmlDW" for consistency with the name used in the following scripts. Scripting the RowFocusChanged Event <SCRIPT language=JavaScript> There's just one more minor point that requires your attention. After HTML DW actions such as Delete, Insert and Update, the reloaded HTML DW resets the current row. Furthermore, the RowFocusChanged event doesn't fire when the Web page loads. Hence, as shown below, you need to call htmlDW_RowFocusChanged() function each time the Web page loads. <BODY bgColor=silver language=JavaScript onload="htmlDW_RowFocusChanged(1);"> Conclusion The main limitation of this technique is that the Pointer column can't have a Tab Order of zero. While Internet Explorer respects the formatting of the column, Netscape Navigator ignores it and displays it as an Input column with a white background and sunken 3D borders. I hope future versions of the HTML DW support the SetItem() method for columns with a Tab Order of zero.
Reader Feedback: Page 1 of 1
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
|
SYS-CON Featured Whitepapers
Most Read This Week |
|||||||||||||||||||||||||||