100
|
Chapter 6
Using Reports to Query and Update Data Sources
Adding a Button with the Viewer API
An Autodesk MapGuide report is generated by right-clicking the map and
then choosing View
➤
Reports from the popup menu. This interface is not
immediately apparent to users, so we’ll make it easier by creating a Parcel
Report button that will display the report.
First we’ll add the following
<SCRIPT>
tag to the
parcel_map.htm
file:
<SCRIPT>
function getMap()
{
if (navigator.appName == "Netscape")
return parent.Left.document.map;
else
return parent.Left.window.map;
}
function runReport()
{
parent.Right.document.write("<P>Select one or more parcels first.</P>");
getMap().viewReport('Parcel Data (CF)');
}
</SCRIPT>
The
<SCRIPT>
tag holds two JavaScript functions. The first function is
getMap
. The second,
runReport
, displays our Autodesk MapGuide report.
The
runReport
function consists of two statements. The first statement
writes a line of text to the right-hand frame of our report application. You
will notice that the text instructs users to select one or more map features.
This instruction displays each time
runReport
is invoked, regardless of
whether the user has selected features. If features are selected, the instruc-
tions are replaced in the frame by the contents of the newly generated report;
otherwise the instructions remain in the frame to provide feedback.
Note
parent
refers to the top-level frame and
Right
is the name we specified
for our right-hand frame in
parcel_frames.htm
. Refer to third-party JavaScript doc-
umentation for more information on writing to frames and windows.
The second statement uses the
viewReport
method to run our report. The
statement begins by calling
getMap
, which returns the map object in the
Web page. The map object is then passed to
viewReport
, which directs
Autodesk MapGuide to display Parcel Data (CF).
Now that our function is defined, we need a way to call it, adding a
<FORM>
element to
parcel_map.htm
:
<FORM>
<INPUT TYPE="button" VALUE="Parcel Report" ONCLICK="runReport()"</INPUT>
</FORM>
Содержание 15606-011408-9300 - MAP R6.3 UPG
Страница 1: ...15306 010000 5060 October 2001 Autodesk MapGuide Release 6 Developer s Guide ...
Страница 6: ...vi ...
Страница 16: ...16 ...
Страница 30: ...30 ...
Страница 84: ...84 ...
Страница 134: ...134 ...
Страница 202: ...202 ...