About browsers and
HTML version The Web DataWindow can generate HTML optimized for different browsers.
You can use the Browser choice on the HTML Generation tab of the DataWindow property sheet to preview what the DataWindow looks like in different browsers. You can also specify an HTML version that the HTML generation should use if it does not recognize the browser.
Designing DataWindow objects
At runtime, a server-side script should find out what browser the current client is using and pass that information to the server component. For information, see “SetBrowser” on page 143 and the SetBrowser method in the DataWindow Reference or online Help.
Using absolute positioning in Netscape
Netscape implements absolute positioning differently than Internet Explorer.
To format the DataWindow with absolute positioning for Netscape browsers, you must set the DataWindow HTMLGen.NetscapeLayers property to TRUE.
You can do this in the DataWindow painter by selecting the Use Layers for Netscape check box on the HTML Generation page of the DataWindow property view. Alternatively, you can use a DataWindow Modify call in the script for the Generate method of the HTML Generator
(nv_remote_datawindow in PBDWRMT.PBL that ships with PowerBuilder).
The default DataWindow HTML generator generates code for determining the browser type and version of the client browser. For Netscape browsers earlier than the 4.0 version, the DataWindow is formatted as an HTML table, whether or not the NetscapeLayers property is set.
Limitations in Netscape
Certain functionality in a Netscape browser using absolute positioning may not be identical to the functionality available with Internet Explorer. For example, you cannot tab between DataWindow columns using a Netscape browser on an NT machine, although you can do this using a Netscape browser on a Solaris machine.
Using JavaScript caching for Web DataWindow methods
You can use the Web DataWindow JavaScript Generator wizard to create JS files (at design time) that contain all the Web DataWindow JavaScript client-side methods. You can start the wizard from the Tool tab of the New dialog box, or from the JavaScript Generation page of the DataWindow property view in the DataWindow painter.
Improving server-side and client-side performance
When you set new DataWindow properties to reference included JS files, the methods defined in the referenced files are not generated with the HTML in any Web DataWindow pages that are sent to the page server and client browser.
Using JS files also reduces the size of the HTML page rendered in the browser.
With JavaScript caching, you improve performance on the client machine as long as the client browser is configured to use cached files. With caching enabled, the browser loads the JS files from the Web server into its cache, and these become available for all the Web DataWindow pages in your application.
There is no client-side performance gain if the browser does not find the JS files in its cache, since, in this case, it reloads the files from the Web server.
Web DataWindow JavaScript Generator wizard
With the Web DataWindow JavaScript Generator wizard, you can generate only one JS file at a time. The wizard gives you the option of including all Web DataWindow methods in a single file, but you can also restrict the types of method to include in each JS file it generates every time you use the wizard.
The different method types correspond to the following DataWindow HTML properties:
Table 6-6: Methods generated by JavaScript Generator wizard in cached files
All of these properties are optional. You can set each of the properties from the JavaScript Generation page of the DataWindow property view, selecting the files you generate with the wizard as values. The wizard registers each file it generates, making it available for selection from the drop-down lists in the DataWindow property view.
Using the ResourceBase property
You must deploy all cached files for your Web application to your Web server.
You can use relative URLs or path names for cached JS files if you specify their location in the HTMLGen.ResourceBase property. (You set these on the JavaScript Generation page of the DataWindow property view in the DataWindow painter.) The ResourceBase property is also used to specify the location of image files.
HTMLGen.property Contents of cached file CommonJSFile Methods used by all DataWindows.
DateJSFile Methods used by DataWindows with date and time formatting.
NumberJSFile Methods used by DataWindows with number formatting.
StringJSFile Methods used by DataWindows with string formatting.
UserJSFile User-defined client-side JavaScript methods—these cannot be generated by the Web DataWindow JavaScript Generator wizard (see "User-defined JavaScript methods"
below).
Designing DataWindow objects
If you do not set the HTMLGen.ResourceBase property, you must include the complete URL in the values of any of the HTMLGen properties that you set.
In either case, the URLs are rendered as SRC attributes inside SCRIPT tags in the pages generated by the Web DataWindow component and sent to the client browser.
Setting the properties
in script You can customize the DataWindow HTML Generator component
(nv_remote_datawindow in PBDWRMT.PBL that ships with PowerBuilder), setting the HTMLGen properties in the script for the Generate method. This example sets the URL location for included files and names the files for common and date-formatted Web DataWindow methods that you deploy to the Web server (and that will be downloaded to browser clients the first time they connect to the Web site):
ids_datastore.Modify &
("DataWindow.HTMLGen.ResourceBase=" +&
"'http://www.myserver.com/JavaScripts'") ids_datastore.Modify &
("DataWindow.HTMLGen.CommonJSFile=" +&
"'dwcomn.js'")
ids_datastore.Modify &
("DataWindow.HTMLGen.DateJSFile=" +&
"'dwdate.js'") User-defined
JavaScript methods You can also reference a file where you store your own client-side JavaScript methods. To use this feature, you must assign the name of the file to the DataWindow HTMLGen.UserJSFile property and make sure the file is available to your Web server. As for the wizard-generated JavaScript files, you can use the HTMLGen.ResourceBase property to set the location for the file, or you can include the complete path to the file in the property value
assignment.
You can make this assignment in the DataWindow painter or in script. The following script sets the user-defined JS file to MyMethods.JS:
ids_datastore.Modify &
("DataWindow.HTMLGen.UserJSFile=" +&
"'http://my_server.com/JavaScripts/MyMethods.JS'") This example will be rendered in the generated HTML page as:
<SCRIPT LANGUAGE="JavaScript" SRC=
"http://my_server.com/JavaScripts/MyMethods.JS">
</SCRIPT>
You can then call client-side methods stored in the MyMethods.JS file from the HTML syntax rendered for (or appended to) controls in a DataWindow object.
For information on generating or appending HTML syntax to controls, see
“Rendering HTML for controls in a Web DataWindow” on page 114.