Incorporating the Data Grid Control into your web page
involves the following four simple steps,
Step 1 - Add the Applet html code to
your web page
Step 2 - Set up the Configuration (Property)
data
Step 3 - Set up the Cell Data
Step 4 - Upload the files to your Web
Server
Step 1 - Add the Applet html code
to your web page
In your
web page place the following code, where you wish the Data
Grid to appear,
<applet
code="AdvDataGridApplet" archive="AdvDataGrid.jar"
width="400" height="300" mayscript>
</applet>
Adjusting
the "width" and "height" element of
this applet tag to specify the size (in pixels) of the desired
grid display.
^back to top
Step 2 - Set up the Configuration
(Property) data
The
Data Grid applet provides the following options for inputting
the configuration data.
a)
Configuration File.
The applet will read all the configuration parameters
from a specified file. To use this option add the following
PARAM tag to your html code between the <applet>
and </applet> tags,
<PARAM
name="gridproperties" value="gridprops.txt">
where
"gridprops.txt" is the name of the file containing
the configuration data ( click
here for an example file ). As you will see from the
example file each property is specified on a name, value
basis. Note that comments may be added to this file by
placing "<!--" at the beginning of a line.
Adjust the property values to specify the characteristics
of the data grid and then place this file in the same
directory as your web page.
For
a full description of each property please see the "Data
Grid Parameters".
This
method is used in Example 2 - click
here to view.
b)
HTML PARAM tags.
Using this option the applet will read all the configuration
information from the standard applet <PARAM> tags.
Simply add the <PARAM> tags, contained in the paramtags.txt
file (click
here), to your html between the <APPLET> and
</APPLET> tag, adjusting the values to specify the
characteristics of the Data Grid.
For
a full description of each property please see the "Data
Grid Parameters".
This
method is used in Example 1- click
here to view.
^back to top
Step 3 - Set up the Cell Data
As with
the configuration data there are several options for supplying
the cell data to the applet,
a)
Data File.
The applet will read all the cell data from a specified
file. To use this option add the following PARAM tag to
your html code between the <applet> and </applet>
tags,
<PARAM
name="griddata" value="griddata.txt">
where
"griddata.txt"
is the name of the file containing the data ( click
here for an example file ). As you will see from the
example file each row of data is supplied on each line
of the file. Each column is separated by a comma (ie.
this is a comma separated file).
This
method is used in Example 2 - click
here to view.
Comma
separated is the default setting however it is possible
to override this so that the data can be separated by
any character of choice or even be of fixed width format.
To
set the character separator to something other than comma,
simply insert the following parameter,
<PARAM
name="dataseperator" value="#">
This will indicate to the applet that the data will be
separated by a # character.
To specify a 'Fixed Width' format the following two parameters
should be added,
<PARAM
name="datafiletype" value="1">
<PARAM
name="fixedwidths" value="20|10|20|10">
where setting "datafiletype"
tells the applet to expect a fixed width data file and
"fixedwidths"
defines the widths (in characters) of each column of data.
For further information on this see the section Grid
Data
b)
Server Side process
This option is the most powerful and gives the applet
the ability to retrieve data from databases without compromising
database security. This method involves specifying a server
side script in the html page which in turn returns the
data to the Grid applet, giving enormous flexibility for
data acquisition.
The
server side script can be constructed in the language
of your choice and as such can be written to acquire data
from the widest variety of sources, multiple databases
etc.
To
instruct the applet to retrieve data from a server side
script simply insert the following <PARAM> tag between
the <APPLET> and </APPLET> tags in your html
page.
<PARAM
name="griddata" value="[URL of Server Process]"
inserting
the URL of your server side application in the value element
of this tag. The
server side script should be designed to output the data
in the same format as the file in option a) above
For
an example script see GridDataServlet.java
in the ServerTemplateScripts directory.
For
a full description of constructing a server side script
which retrieves data from a database see the section "Connecting
the Data Grid to a database" under the "Grid
Data " section ( or click
here).
This
method is used in Example 3 - click
here to view.
c)
HTML PARAM tags.
Using this option the applet will read all the grid
data from the standard applet <PARAM> tags. Simply
add the <PARAM> tags, contained in the dataparamtags.txt
file (click
here), to your html between the <APPLET> and
</APPLET> tag, adjusting the values to specify the
data for the grid.
This
option is the simplest method of supplying data to the
grid applet and is probably most useful where the grid
data is either static or the html page is constructed
dynamically, (e.g.. Via ASP or JSP.)
This
method is used in Example 1 - click
here to view.
^back to top
Step 4 - Upload the files to your
Web Server
The
final step is to simply to place the AdvDataGrid.jar file
in the same directory as your web page. At only 19kb this
jar file contains all the applet code for producing the
Data Grid in your page and as such is very fast to load
and run.
^back to top
If you
experience any difficulties implementing then please do
not hesitate to contact us at,
support@jpowered.com