The data grid is critical to all sorts of development on all sorts of platforms and in all sorts of languages. ColdFusion has supported data grids since ColdFusion 2 – first a Java applet, then a Flash control, and in ColdFusion 8 we’ve added an HTML data grid that can be pre-populated with data, or which can be used to display live data loaded asynchronously.
The basic pre-populated data grid functions much like the
SELECT artistid, lastname, firstname, email
FROM artists
ORDER BY lastname, firstname
Here a
The new
This data grid is displayed in a window created using the new
Now for the CFC:
SELECT artistid, lastname, firstname, email
FROM artists
ORDER BY #ARGUMENTS.gridsortcolumn# #ARGUMENTS.gridsortdir#
The getArtists returns a structure (containing data in the format required by the data grid), and accepts four arguments, the same four arguments passed in the client side bind attribute. The first two are always passed by the client, and so they are required. The latter two are only passed if the user clicks on a column header to sort the data, and so those arguments are not required and default to “”.
This is a basic example, and we’ll look at additional functionality in future posts.
Leave a Reply