You are currently on IBM Systems Media’s archival website. Click here to view our new website.


Modernizing With PHP Grid Tools

The second version was achieved by simply adding this additional code to the script:

$dg -> set_row_color('yellow', 'lightgray', 'lightblue');
$dg -> set_col_title("customerNumber","Customer #");
$dg -> set_col_title("customerName", "Name");
$dg -> set_col_title("city", "City");
$dg -> set_col_title("state", "State");
$dg -> set_col_title("country", "Country");
$dg -> enable_search(true);

The first line sets the row colors to alternate (green bar paper, anyone?) and to highlight the current cursor position in yellow. The second and subsequent lines set the column headings. The last line is responsible for the filtering boxes that appear above each column. We have entered a value of “USA” into the country box and you can see the results.

Having used this product for a while now, we can see why it gets so many rave reviews from its users. As a prototyping tool, it’s really hard to beat and just the thing to help you and your users make decisions as to what you really need to develop for the longer term. Visit the company’s website to see working examples of many of the additional features the product provides.

phpGrid offers multiple pricing options ranging from free to $1,295 for the high-end version, which includes full source code. To see what you get for your money at the different levels, take a look at the company’s download page.


iDataGrid provides similar capabilities but with three major differences:

  1. It supports DB2 out of the box. In fact, it was designed as an IBM i tool by former Zend staff who were instrumental in bringing PHP to the IBM i. It also supports MySQL, MSSQL and others. We’ve successfully used it with both DB2 and MySQL.
  2. You use a wizard interface to define the content of your application and it generates a PHP script to implement your specifications. Unlike some similar tools, it stores all of the choices you made in a separate database so the application can be regenerated at a later time should you wish to make changes. You can also directly modify the script, but of course you need to be aware that such changes will be lost if the application is regenerated. It would therefore be a good idea to isolate any such changes in include members thereby minimizing rework.
  3. Editing and other features that are only available in the for-fee versions of phpGrid are part of the basic free version of iDataGrid.

While iDataGrid is free of charge, the company does offer a service contract option which, in addition to technical support, also provides you with access to additional features such as their “Pro” options. Currently, this is priced at approximately $2,500 per year.

When you first connect to iDataGrid, you’re presented with the Pages Manager as shown in Figure 3. From this point, you can create a new page or edit an existing one either via the “Code” or “Wizard” option links.

Once pages are developed and tested, you can copy them anywhere you like, so don’t be concerned that users will have access to this interface; they won’t.

To produce the same basic application we showed you with phpGrid requires that we complete three sections of the wizard dialog. The first, shown in Figure 4, is the “Creating & Calling” section where we define the type of database we’re using along with the User Profile information. The second is the “Sorting & Paging” section where we specify whether we want paging built in, how many rows on a page and where the paging controls should appear. The third is the “VIEW Mode Settings” where we define the basic SQL query and identify the fields we want included in the grid. In our case, we opted to show all the selected fields. You can also select the width of the grid and whether you want a horizontal or vertical view with horizontal being the norm.

That’s all there is to it. The resulting Web page in Figure 5 is not bad for two minutes of work!

As you can see, even though we specified a page size of 20 rows, users can change this value if desired. They can also sort on any column, add new records, etc.

To enhance the page to a similar level to the second phpGrid example, we had to change settings in three other sections.

  1. “General” where we specified the page heading and also the export options. We also selected an alternative look and feel by requesting a different style sheet from the standard set.
  2. “Printing & Exporting” where we specified that we wanted the option to export the results in PDF, Excel and XML formats.
  3. “Filtering” where we specified the columns that we wanted to be able to use for filtering and the criteria to be applied. Unlike phpGrid, iDataGrid requires that you specify each column you want to filter. While that’s more work, the number of selection options available is far more comprehensive. If you look at Figure 6, you’ll see that we opted to have the Name field as a text box and selected %like% as the operator which will search for the text we enter anywhere in the field. We also specified that Country should be a pull-down list built from the values present in the database.

Once those options had been specified, we recreated the page and ran it, as shown in Figure 7. To demonstrate the country filtering, we captured it in action with the pull-down deployed. You can also see the new color scheme and the icons for the export options we selected.

Hero Status

With both tools, our first live pages were produced within minutes of installing the product. In the case of phpGrid, this involved nothing more than uploading the source files to the document root on our Apache server. In the case of iDataGrid, it involved uploading and restoring a save file and executing an install command.

Neither tool is perfect, but either can certainly save you a lot of time and effort and we’ll be making use of both in our own applications. Check them out and take the firsts step to hero status with your users.

Jon Paris is a technical editor with IBM Systems Magazine and co-owner of Partner400.

Susan Gantner is a technical editor with IBM Systems Magazine and co-owner of Partner400.



2019 Solutions Edition

A Comprehensive Online Buyer's Guide to Solutions, Services and Education.


A Debate: DDS vs. DDL

Should you switch your DDS defined files to DDL?

IBM Systems Magazine Subscribe Box Read Now Link Subscribe Now Link iPad App Google Play Store
IBMi News Sign Up Today! Past News Letters