2.4 Script Evaluation

Unlike conventional JavaScript on web pages, JavaScript that you embed in a Style Intelligence report is executed as part of the report generation process on the server, not the client browser. However, scripts can control certain client-side interactions through event handlers and hyperlinks.

The overall sequence of report script evaluation is as follows.

1. Execute the onInit Handler.

2. Prompt the user for any parameters, and processes element data bindings. (Queries are not yet executed.)

Tip: Because of its sequence position, the onLoad handler has access to all parame­ters and data binding information (meta­data), but not to actual data returned by que­ries.

3. Execute the onLoad Handler.

4. Execute all element queries.

5. Evaluate all formula column scripts.

6. Execute all element-level scripts.

Figure 2. Evaluation Sequence

 

The last stage in the script evaluation sequence above (element-level scripts), is governed by the following rules:

Elements in the body of each page are evaluated before elements in the page header and footer.

Header elements on each page are evaluated before footer elements.

In a flow report, elements are evaluated in flow order: Scripts attached to elements at the front of the flow are evaluated before scripts attached to elements at the rear of the flow.

In a tabular report, elements within a grid cell are evaluated in flow order: Scripts attached to elements at the front of the flow within a given cell are evaluated before scripts attached to elements at the rear of the flow in the same cell.

In a tabular report, elements within the grid are evaluated in row order: Scripts attached to elements in an earlier grid row are evaluated before scripts attached to elements in later grid rows.

In a tabular report, elements within different grid cells of the same row do not have a pre-determined evaluation sequence.

If a script modifies only the properties of the same element to which it is attached, the evaluation order does not matter.

In practice, if an element is visually below another element in the report, it is normally safe to assume that the lower element is evaluated after the upper element. The primary exception is elements residing in different tabular report cells.

See Also

Script Debugging, for evaluation order-issues, and scripting best practices.

Bean Handlers, for information about execution of scripts within beans.

Client-Side JavaScript, for information about attaching client-side JavaScript.

<< 2.3.4 Protect Reports from Script Errors © 1996-2013 InetSoft Technology Corporation (v11.5) 2.5 Host Environment >>