» Fig Leaf Software Home

We've Got You Covered.

Monday, December 21, 2009

Changing the contents of a ColdFusion 9 CFGRID control

Here's a handy little JavaScript function for dynamically changing the contents of a ColdFusion 9 CFGRID control:

function gridSetElementValue( gridname,row,column,thevalue)
       var objGrid = ColdFusion.Grid.getGridObject(gridname);
       objRow = objGrid.store.data.items[row];

In order to determine the row number of the currently selected grid row you must define an event listener for the grid as indicated below. Note the following:
  • The function must be declared within the section of the page
  • You must use ColdFusion’s ajaxOnLoad() function to invoke the event listener definition
var selectedRow = 0;
 initGrid = function()
  var grid = ColdFusion.Grid.getGridObject("incidentGrid");
  grid.addListener("rowclick", function(objGrid, rowNumber, e){
    selectedRow = rowNumber;

Invoke using the following:

<cfset ajaxonload("initgrid")>

No comments:

Post a Comment

About Us

Fig Leaf Software is an award-winning team of imaginative designers, innovative developers, experienced instructors, and insightful strategists.

For over 20 years, we’ve helped a diverse range of clients...

Read More

Contact Us


Fig Leaf Software

1400 16th Street NW
Suite 450
Washington, DC 20036