Question

ext 3 data grid renders without data

Asked by: twalker916

I am trying to create my first grid panel in Ext js - I have a ColdFusion 8 program mwCounties.cfm a ColdFusion 8 component  - ext.cfc and a Javascript file - mwCounties.js.
I am using Firefox on a Windows Vista machine. Everything appears to run fine but the grid panel renders without the data. I have attached  a picture of the firefox showing the grid and the data is shown below in the firbug console.

the cfm code (mwCounties.cfm)...
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>MembwerWeb Counties</title>
		<meta name="author" content="Stephen G. 'Cutter' Blades" />
		<script language="javascript" type="text/javascript" src="../ext/ext-base-debug.js"></script>
		<script language="javascript" type="text/javascript" src="../ext/ext-all-debug.js"></script>
		<script language="javascript" type="text/javascript" src="../ext/custom/CFQueryReader.js"></script>
		<script language="javascript" type="text/javascript" src="../ext/lrnext3/mwCounties.js"></script>
		<link rel="stylesheet" type="text/css" href="../ext/css/ext-all.css" />
	</head>
	<body><!-- Intentional comment. Leave in place -->
		<div id="mainContent">
			<div id="counties" style="margin:25px;"></div>
		</div>
	</body>
</html>
 
the JavaScript code (mwCounties.js)...
/*
 * Data Store from custom reader
 */
Ext.onReady(function(){
	var recordModel = [
		{name:'STATE',mapping:'STATE'},
		{name:'COUNTY',mapping:'COUNTY'},
		{name:'REGIONID',mapping:'REGIONID',type:'int'},
		{name:'REGION',mapping:'REGION'},
		{name:'REGIONNAME',mapping:'REGIONNAME'},
		{name:'FIPS',mapping:'FIPS'}
	];
    var countyReader = new Ext.data.CFQueryReader({id:'STATE',root:'DATA'},recordModel);
	var countyStore = new Ext.data.Store({
		url:'cfc/ext.cfc',
		baseParams:{method: 'getCounties',returnFormat: 'JSON',queryFormat: 'column'},
        reader: countyReader
	});	
	countyStore.load();
	var grid = new Ext.grid.GridPanel({
		renderTo:'counties',
        frame:true,
		title:'Memberweb Counties',
		width:500,
		height:500,
        store: countyStore,
		columns: [
            {header: "State", dataIndex: 'STATE'},
            {header: "County", dataIndex: 'COUNTY'},
            {header: "Region ID", dataIndex: 'REGIONID'},
            {header: "Region", dataIndex: 'REGION'},
            {header: "Region Name", dataIndex: 'REGIONNAME'},
            {header: "FIPS", dataIndex: 'FIPS'}
		]
	});
});
 
the CFC code (ext.cfc)...
<cfcomponent output="false">
	<!---
	 /	METHOD: counties
	 /
	 /	@param	regionid:numeric
	 /	@return	output:query
	 --->
	<cffunction name="getCounties" access="remote" output="false" returntype="query">
		<cfset var q = "" />
		<cftry>
			<cfquery name="q" datasource="memberWebdb">
				select 
            		state
            		,county
            		,tc.regionid
            		,region
            		,regionname
            		,fips 
            	from 
            		tcounty tc 
            		inner join tregion tr on tr.regionid=tc.regionid 
            	order by 
            		state
            		,county
               
			</cfquery> 
			<cfcatch type="database">
				<!--- Place Error Handling Here --->
			</cfcatch>
		</cftry>
		<cfreturn q />
	</cffunction>
</cfcomponent>

                                  
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:

Select allOpen in new window

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-11-04 at 11:13:31ID24872082
Tags

Ext js; ColdFusion; JavaScript

Topics

JavaScript Frameworks

,

JSON

,

ColdFusion Application Server

Participating Experts
1
Points
500
Comments
30

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Theme and Custom VType problems with Ext JS
    I am currently developing a website for a local golf course to allow customers to sign up with NCGA tournaments online. I am using Ext JS for the form, PHP for the database stuff, and Dreamweaver's Spry for the navbar. The form is functioning correctly however I have 2 issues...
  2. Ext JS Grid Vertical Scrollbar Problem
    I have a problem that deals with the vertical scrollbar not showing up within a grid component from the Ext JS Library 2.0.1 (http://extjs.com/). I have posted the question in their forum with very poor results. I am hoping one of you experts might have a clue as to what co...
  3. Ext Grid, call function...
    Hi, I built a grid using Ext. I add an href columns. I need to call a web method by clicking each link and send a parameter. I tried to render the Header, and call Title function - see bellow... (which suppose to call a web method, but with no success, it loads the asmx file ...
  4. EXT JS HELP NEEDED
    Hi, I was trying to use ext js framework, I t is taking more time than we have to make it work. I need following features available in any famework other than ext js.(I chose ext js initially due to these features) 1.the whole UI of ext js. 2.grid control (with both read-o...
  5. Ext JS Issue, Date field showing NaN/NaN/NaN
    I have a setup that follows the Ext.data.DataWriter Example on the Ext JS site, with the exception that I didn't extend any classes. The create, update, read, destroy is all working perfectly fine with the grid. All the columns are working perfectly fine except for the date c...
  6. How do I open a new browser window in Ext js
    I have a grid panel in ext js. One of the cells contains a url to a web site. When I click on the cell I can get the url and I do a window.open(url,name,features) but the window that opens prepends the http://current location to the url. I want a regular browser window that w...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: azadisaryevPosted on 2009-11-04 at 11:46:25ID: 25743119

are you using cfqueryreader ver 1.2? 1.1 had issues with loading data store...
http://blog.cutterscrossing.com/index.cfm/2009/7/29/CFQueryReader-v12--Update-Supporting-ExtJS-3x

hmm... and Cutter's demo does show data returned in a different format than yours...

Azadi

 

by: twalker916Posted on 2009-11-04 at 12:39:19ID: 25743650

Yes.. I am using v1.2. I did a cfdump and the column headers are all uppercase - how does the format of the returned data differ?

 

by: azadisaryevPosted on 2009-11-04 at 23:26:03ID: 25747371

remove root:'DATA' from var countyReader.
this is what it should be like:

var countyReader = new Ext.data.CFQueryReader({id:'STATE'},recordModel);

Azadi

 

by: twalker916Posted on 2009-11-05 at 09:13:48ID: 25751660

Nope... same result. Also the FIPS field is being treated as a number even though the sql server field is defined as a varchar(5)... I appreicate your help - hope we can find an answer - anything else I can do to help figure this our?

 

by: azadisaryevPosted on 2009-11-05 at 10:02:34ID: 25752114

hmm... i have exactly your code in a test app that works just fine - the grid populates and all...

what i do not like is that in the image you posted there are 2 or 3 blank lines before the returned data in firebug console... there sholdn't really be any whitespace prepended to the json object returned by cfc call - that would break json.

is something adding whitespace to the cfc response? whitespace in Application.cfm is a usual suspect...

Azadi

 

by: twalker916Posted on 2009-11-05 at 10:24:03ID: 25752316

Did not work but excellent catch - this is a new install of Coldfusion and I had not checked whitespace management. Also I have tried it with and without "prefix seralized json with //" to no effect. So you created a sql table like mine and it works on your machine?

 

by: azadisaryevPosted on 2009-11-05 at 10:37:27ID: 25752448

i used the same example as in cutter's cfqueryreader, just renamed the query columns to match yours and used your code to create data store and grid. well, the data returned is, of course, different.

the only thing i had to change in your code for it to work was remove the root:'DATA' bit.

can you post your mwCounties.js file as you have it now, just to make sure no errors crawled into it while you were trying different things?
add a .txt extension to the file and attach it here.

Azadi

 

by: twalker916Posted on 2009-11-05 at 10:48:07ID: 25752549

Here it is - all of the code involved...

 

by: azadisaryevPosted on 2009-11-05 at 11:38:55ID: 25753079

nope, all good...
i have adjusted my test code even more to represent your code - it's pretty much identical now except for cfc name.

so... i am at a loss as to why yours does not work...

your data IS being returned from cfc, as seen in your image, so no problem with that.
your grid is rendered on screen - so that's working
the data is not going into the grid, though...

which cf version and update level are you running? that's probably the last thing i can think of for tonight...

of course, there may still be something - not immediately visible to the naked eye - wrong with the data returned from your cfc...

btw, are you using Application.cfm or .cfc? if .cfc: do you have onRequest() method in it? do you onRequestStart()/onRequestEnd() methods output anything or set http headers or something like that?
if .cfm: do you also use onRequestStart.cfm and/or onRequestEnd.cfm?

Azadi

 

by: twalker916Posted on 2009-11-05 at 11:56:41ID: 25753256

Application.cfm
ColdFusion Vesion: 8,0,1,195765
The ColdFusion Server is on a Windows Server 2008 64bit machine and Sql Server is SQL 2008

 

by: twalker916Posted on 2009-11-05 at 12:04:43ID: 25753344

Seems to me that the problem must be in the cfQueryReader since the reader uses cfQueryReader and the store uses the reader and the grid uses the store and the cfc is returning the data in json format... but I don't know how to trouble shoot cfQueryReader...

 

by: twalker916Posted on 2009-11-05 at 12:05:40ID: 25753357

Is there another good alternative to cfQueryReader?

 

by: azadisaryevPosted on 2009-11-05 at 12:12:50ID: 25753428

let's run a quick test of your returned data.

save attached code as a .cfm page in the same folder as your mwCounties.cfm and run it with firebug open.

do you see the data object logged in firebug console?

Azadi

<cfajaxproxy cfc="cfc.ext" jsclassname="cfcProxy">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">
runTest = function() {
	var p = new cfcProxy();
	p.setCallbackHandler(testCB);
	p.setErrorHandler(testErr);
	p.getCounties();
}
testCB = function(result) {
	console.log(result.COLUMNS);
	console.log(result.DATA[0]);
	console.log(result);
}
testErr = function(code, message) {
	console.log(message);
}
</script>
</head>
<body onload="runTest();">
<p>make sure firebug console is open.</p>
</body>
</html>

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:

Select allOpen in new window

 

by: azadisaryevPosted on 2009-11-05 at 12:14:56ID: 25753448

>> Seems to me that the problem must be in the cfQueryReader

no, i do not think so, because the exact same CFQueryReader works just fine for me... i even replaced the CFQueryReader.js file i had with the one you posted.

Azadi

 

by: twalker916Posted on 2009-11-05 at 12:17:38ID: 25753476

I just pointed it to CFJsonReader and the grid loaded... so I am willing to accept your solution if you want to close this out. I do not know why CFQuerayReader won't work but am willing to stop trying if you wish to stop...

 

by: azadisaryevPosted on 2009-11-05 at 12:19:48ID: 25753502

PS:

with the test code i posted you should see output in firebug something like this:
["STATE", "COUNTY", "REGIONID", "REGION", "REGIONNAME", "FIPS"]
["CA", "ALAMEDA",2, "HCNCC", "Hospital Council of North and Central California", 6001.0]
{ COLUMNS=[X] DATA=[Y] }

if you do not - we have a problem with data...

Azadi

 

by: azadisaryevPosted on 2009-11-05 at 12:22:53ID: 25753534

>> I just pointed it to CFJsonReader and the grid loaded

now that's weird...
are you sure you had cfqueryreader.js linked to correctly?

Azadi

 

by: twalker916Posted on 2009-11-05 at 12:27:37ID: 25753603

Yep linked correctly BUT if cfqueryreader.js is relying or some other files being in a specific place there could be a problem there.

 

by: azadisaryevPosted on 2009-11-05 at 12:28:16ID: 25753612

feel free to close the question if you want to.
also feel free to mark me as assisted solution and mark your own comment about switching to cfjsonreader as solution.

i will try to contact Cutter to let him know about this issue...

Azadi

 

by: azadisaryevPosted on 2009-11-05 at 12:30:40ID: 25753640

>> BUT if cfqueryreader.js is relying or some other files being in a specific place there could be a problem there

it does not seem to be - i just moved it to a completely different folder and my grid still loaded fine...

Azadi

 

by: azadisaryevPosted on 2009-11-05 at 12:32:17ID: 25753663

just to be absolutely sure about your data - could you run the test code i posted?
maybe cfjsonreader is more forgiving about data format, or parses it in some way to make it renderable if it is not...

Azadi

 

by: twalker916Posted on 2009-11-05 at 12:32:37ID: 25753668

What is the difference between CFJsonReader and CFQueryReader? Why would I want to use one over the other? You have been a great help...

 

by: twalker916Posted on 2009-11-05 at 12:35:56ID: 25753708

Here are the test results

 

by: twalker916Posted on 2009-11-05 at 12:45:09ID: 25753809

why don't you post back your working mwcounties.js file and I will make sure I don't have a typo...

 

by: azadisaryevPosted on 2009-11-05 at 12:58:09ID: 25753935

>> Here are the test results

thanks. so your data is all-ok - proper json object.

>> why don't you post back your working mwcounties.js file and I will make sure I don't have a typo
well, my mwcounties.js is an exact copy of yours! the one and only difference is the url to the cfc.

>> What is the difference between CFJsonReader and CFQueryReader? Why would I want to use one over the other?

i am not sure - i do not recall ever using cfjsonreader... from the posts on extjs forums it looks like cfqueryreader is just an extended cfjsonreader and allows you to work with plain cf query returned from cfc instead of having to use queryconvertforgrid() on it first...

did you try returning a query converted for grid from your cfc with cfqueryreader, btw?

still extremely strange that it works in my tests by not in yours... wonder if it has anything to do with win2008 server...

Azadi

 

by: twalker916Posted on 2009-11-05 at 13:36:35ID: 25754306

I am going to close this out so you can get the points. Here is my email address in case you find anything else... twalker@calhealth.org. Thanks for all your help.

 

by: twalker916Posted on 2009-11-05 at 13:38:08ID: 31650161

It is people like this that make EE worth what it costs and even more...

 

by: twalker916Posted on 2009-11-06 at 08:09:18ID: 25760358

Do you think it could be SQL 2008?

 

by: azadisaryevPosted on 2009-11-16 at 06:35:58ID: 25830510

>> Do you think it could be SQL 2008?

no, i know it is not - i tested it.

but guess what?
i also found out that in my tests i was using ext js 3.0.0, while you, i am sure, were using the latest ver 3.0.3.
and - yes you guessed it - cfqueryreader does not yet work with ver 3.0.3. so no wonder you were having problems!

strange thing, though - i was sure i was using ver 3.0.3. in fact, the downloaded extjs package i used is named 3.0.3, but the files inside it are ver 3.0.0... go figure!

Azadi

 

by: azadisaryevPosted on 2009-11-17 at 16:35:34ID: 25845773

Steve has updated cfqueryreader to work with ext js 3.0.3. you can download the latest version form http://cfqueryreader.riaforge.org/

Azadi

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...