tracker issue : CF-3793029

select a category, or use search below
(searches all categories and all time range)
Title:

ajaxonload executes before grid object is available

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Jim Ward / Jim Ward (Jim Ward)

Created: 07/22/2014

Components: AJAX

Versions: 11.0

Failure Type:

Found In Build/Fixed In Build: CF11_Final / 11.0 U3

Priority/Frequency: Major / All users will encounter

Locale/System: English / Win 2008 Server R2 64 bit

Vote Count: 0

Duplicate ID:	CF-3697683

Problem Description:  When trying to use any ColdFusion.grid related function in a function that is called by ajaxOnLoad, the grid object is not available.  This worked in Coldfusion 10.

Steps to Reproduce:  Here is the code to reproduce:

<html>
	
	<head>
		<script type="text/javascript">
	var aproxy;
	var tb;
	var grid;
	
	function initPage()
	{
		Ext.QuickTips.init();
		grid = ColdFusion.Grid.getGridObject('testGrid');
    	grid.on('mouseover', mouseOver);	
    	
    	//tb = ColdFusion.Grid.getTopToolbar("openSolicitations");
	
	//tb.add({text:"Open Solicitations"});
	}
	
	function mouseOver() {
		
	}
</script>
</head>

<body>
<cfoutput>
<cfform id="testForm">
			<div id="stylized">
				<div class="mybody" style="margin-bottom:10px;">
			<h3>Test page
</h3>
</div></div>
<cfgrid name="testGrid" 
	format="html" rowheight="100" title="Test Grid" 
		colheaderalign="left" align="middle" >
	<cfgridcolumn name="PERSON_ID" header="Name" width="150" dataalign="left"/>
	<cfgridcolumn name="LAST_NAME" header="Description" width="450"/>
	<cfgridcolumn name="FIRST_NAME" header="Open Date" width="110"/>
</cfgrid>
</cfform>
</cfoutput>

<button onClick="initPage()">Test</button>

<cfset ajaxOnLoad("initPage")/> 
</body>
</html>

Actual Result:  Javascript error:  TypeError: grid is undefined

Expected Result:   Grid object should be available at this point.

Any Workarounds:  Stay at Coldfusion 10.

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3793029

External Customer Info:
External Company:  
External Customer Name: Yodeler
External Customer Email:  
External Test Config: My Hardware and Environment details:  Windows server 2008 R2 64 bit.  IIS 7.5.

Attachments:

Comments:

The "Test" button does work, which calls the same function.
Comment by External U.
11536 | July 22, 2014 02:57:17 PM GMT
Hi Yodeler, Can you please try wrapping the references to the grid objects within Ext.onReady method, like so: function initPage(){ Ext.onReady( function(){ var grid = ColdFusion.Grid.getGridObject('TestGrid'); }); } Refer : http://docs.sencha.com/extjs/5.0.0/apidocs/#!/api/Ext-method-onReady http://www.sencha.com/forum/showthread.php?33987-Ext.onReady-function
Comment by Piyush K.
11537 | July 23, 2014 06:14:36 AM GMT
Thanks for the quick reply. Ok, that works, though it would be nice to have this in the Coldfusion documentation since the way I had it worked in Coldfusion 10. Now how do I get around the relative positioning of the columns in the grid with the ExtJS upgrade? The columns start with the first column of data returned from the bind, not the first column defined with cfgridcolumn. Thanks.
Comment by External U.
11538 | July 23, 2014 07:37:17 AM GMT
Yodeler, The column data mismatch issue is logged as bug #CF-3712885. It is fixed and the fix shall be made available in the next product update. About this bug, wrapping the grid references in Ext.onReady is only a workaround for now. We expect this to be fixed as well in the next update. Thanks.
Comment by Piyush K.
11539 | August 14, 2014 08:32:52 AM GMT
Hi Piyush, CF-3697683 is currently hidden. Could you please make CF-3697683 visible, so we can track it? Thanks!, -Aaron
Comment by External U.
11540 | December 23, 2014 04:39:38 AM GMT
This issue was fixed for ColdFusion.Grid functions, but not for ColdFusion.Layout functions. Filed CF-3914318 for ColdFusion.Layout functions. Thanks!, -Aaron
Comment by External U.
11541 | December 23, 2014 03:30:28 PM GMT