data grid control

Advanced Data Grid Control

[ Data Grid Home ] [ Documentation ] [ Examples & Demos ] [ Buy Now ]

Advanced Data Grid Control

Supplying Cell Data to the Data Grid Control

advanced data grid control

There are several methods by which data can be supplied. The supported methods for supplying data are,

In addition to display data it is also possible to add the following features to any grid cell,

Adding a URL Hyperlink - click here

Adding an Icon Image - click here

 

a) via a Plain Text Data File.
Under this method The applet will read all the cell data from a specified file. The data can be in one of 2 formats,

  • Character (comma) Separated or
  • Fixed Width

In both cases each row of data is supplied on each line of the text file.

Character Separated
This is the most common format and generally a comma character is used to separate the columns of data on each row. By default the Data Grid will assume the data is separated by a comma and so if your data is in this format then simply add the following parameter,

<PARAM name="griddata" value="griddata.txt">

replacing "griddata.txt" with the URL to your data file.

If your data is separated by a character other than a comma (eg. a hash # character) then you can override the default setting with the following parameter,

<PARAM name="dataseperator" value="#">

The character separated method is used in Example 2 - click here to view.

Fixed Width
Data may also be supplied in Fixed Width format. Here is column of data resides at certain specified character positions within each row. For example if you have 4 columns of data then data may reside in the following positions,

  • Column 1 - positions 1 to 19 - (19 characters)
  • Column 2 - positions 20 to 29 - (10 characters)
  • Column3 - positions 30 to 59 - (30 characters)
  • Column 4 - positions 60 to 64 - (5 characters)

When supplying data from a file the Grid Control will assume the data is character separated, however this can be overridden with the "datafiletype" parameter. To specify Fixed Width format the following parameter should be added,

<PARAM name="datafiletype" value="1">

In addition the column widths need to be defined. This is done with the "fixedwidths" parameter. Here the number of characters for column are simply stated separated by a "|" character. For the example above we would need,

<PARAM name="fixedwidths" value="19|10|30|5">

^back to top

b) via a Server Side Script (Database Connectivity)

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 (eg. ASP, PHP, JSP, Java Servlet etc.) and as such can be written to acquire data from the widest variety of sources, multiple databases etc.

The server side script should be designed to produce output in the format described for the supplying data via a plain text file. Note: The script does not need to produce a physical file it just needs to return the data in this format.

As with supplying data via a file, you can choose this format to be either,

  • Character (comma) Separated or
  • Fixed Width

    (see previous section for full description)

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.

For an example script see GridDataServlet.java in the ServerTemplateScripts directory. This is a simple Java Servlet but equally the same method can be employed in any scripting language,

ie. Upon request,

  • Connect to Database
  • Read the Database records
  • Process and Format the data
  • Return the Data

This method is used in Example 3 - click here to view.

^back to top

c) From within the HTML page via PARAM tags

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.)

Under this method each row of data is supplied by a "dataN" parameter where N represents the row number. The row numbering should begin with 1 and be continuous.

When supplying data via the HTML param tags the data must be in "Comma Separated" format.

For an example set of Data Parameters see the file dataparamtags.txt (click here).

This method is used in Example 1 - click here to view.

^back to top

 

Adding a URL Hyperlink

Any Cell in the grid can have a hyperlink URL attached to it. This is done by adding the following to the data string,

<URL=[hyperlink url]>

<TARGET=[target frame]>

for example to have the cell which contains the data "cell 1 data" link to Jpowered and display the result in the current browser window, the data would be,

cell 1 data<URL=http://www.jpowered.com><TARGET=_self>

In the dataparamtags.txt file you will see that all the column 1 data has a URL link added.

^back to top

 

Adding an Icon Image

Any Cell in the grid may have an icon image attached to it. This is done by simply adding the following to the data string,

<IMG=[URL of image file]>

For example to the image "cellimage1.gif" displayed in the cell for the data "cell 1 data" you would have,

cell 1 data<IMG=cellimage1.gif>

^back to top

« back to Getting Started
[ Data Grid Home ] [ Documentation ] [ Examples & Demos ] [ Buy Now ]

Getting Started

Documentation

Examples

buy data grid control

 

copyright notice