Controlling what is generated – PB Docs 126

Controlling what is generated

Disabling features of the client control


Although the server component generates a considerable amount of
HTML or XHTML and JavaScript for the Web DataWindow client control, it
is still no more than an average image file. However, to reduce
the size of the control on the client, you can instruct the component
to leave out code for features you are not using. You can tell the
component to omit code for:

  • Updating data

  • Validating newly entered data

  • Client-side events

  • Allowing client-side scripts to call methods of
    the client control

  • Applying display formats to newly entered data

You can disable any of these on the Web Generation property
page in the DataWindow painter or with the SetWeight method. False
for a particular argument means no code for that feature is generated.

This statement enables all features:

If updating of data is false, no validation or display formatting
code is generated either. In this statement, it does not matter
what the second and fifth arguments are, because the first argument
for updating data is false:

This statement turns off the client-side scripting capability:

Updating data and display formatting add the most code to
the client-side control. Date processing also generates additional
code. For the smallest client control, turn on only the features
you need and make sure your DataWindow object does not have any
date columns.

Naming the client control


You need to provide a name for the Web DataWindow client control.
The name is used for page parameters and client-side events. If there
is more than one Web DataWindow client control on the Web page,
each needs a unique name.

This code uses the same name for the server component variable
and the client control:

note.png XML Web DataWindow

If you are using an XML Web DataWindow with a custom XHTML
template, the object name in the template must match the name of
the client control (dw_1 in the example).

Optimizing HTML for a browser


The Web DataWindow can generate HTML optimized for particular
browsers and versions. In particular, it can generate code for Microsoft
and Netscape browsers. The browser might be different
each time the server component is instantiated by a different client,
so this information cannot be preset in the DataWindow painter.
You can tell it what browser and version to target in the server-side
script. In the painter, you can set the HTML Version property to
specify what level of HTML to generate if the browser is not recognized.

For information on what HTML features the DataWindow uses
for different browsers, see the DataWindow Reference or
the topic in online Help.

At runtime, the HTTP header sent from the client browser to
the Web server contains the User-Agent or HTTP_USER_AGENT
value, which the server component can use to identify the client

Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x