Workaround for ajax cfgrid bug in CF11 in which ajaxonload() is not working properly

In coldfusion 11 release there is an open bug in which if you try to use any ColdFusion.grid related function in a function that is called by ajaxOnLoad, the grid object will not be available. 

A grid will load properly, but when the javascript function is called with AjaxOnLoad and  function tries to reference the grid, you will get that the reference is “undefined”.

This is a sample code :

<html> 

   <head> 

      <title>AjaxOnLoad test</title> 

        <script> 

            init = function() 

            { 

                ColdFusion.Grid.sort(‘datagrid’, ‘col_one’, ‘ASC’);

            } 

        </script> 

    </head> 

 <body> 

        <cfform name=’formOne’>

            <cfgrid name=’datagrid’ format=”html” textcolor=”blue”>

                <cfgridcolumn name=’col_one’>

                <cfgridrow data=”data1″>

                <cfgridrow data=”data2″>

                <cfgridrow data=”data3″>

            </cfgrid>

        </cfform>

        <cfset AjaxOnLoad(“init”)> 

    </body> 

</html>

The above code will break at “ColdFusion.Grid.sort(‘datagrid’, ‘col_one’, ‘ASC’);” as grid object will not be available at that moment.

 

Workaround :

The current workaround for this issue is to wrap the references to the grid objects within Ext.onReady method, like this:

   init = function() 

            {

   Ext.onReady(function ()

                {

                                 ColdFusion.Grid.sort(‘datagrid’, ‘col_one’, ‘ASC’);

});

            } 

 

Note: Fix for this bug will be available in next update

3 thoughts on “Workaround for ajax cfgrid bug in CF11 in which ajaxonload() is not working properly

  1. I hope that update is also resolving the extremely long app initialization times. 8-11 secs to initialize an app is absurd. At that point either the page is timing out or the user has already given up and left.

    If the general attitude is well it only needs to happen once over 15 minutes, its invalid. I can name off countless scenarios. Where a revenue driving application suffers severely under this current wait time. It needs to be fixed ASAP.

Leave a Reply

Your email address will not be published. Required fields are marked *