View Full Version : stuck: ExtJSinAction chapter 7 all looks good but no results

9 Nov 2010, 7:25 AM
Noob here.
Working my way through chapter 7, wanting to see a grid with server data.

This is a stripped-down version.
I've tried various flavours and all end up at the same place.
Everything looks fine, no errors, response sent, received... but no data displayed.

Feels like I need to kick the display somewhere.
Or that I have left something disconnected between the data source and the control...

I am just not seeing or guessing correctly.
While it's a great way to learn, I really wanna see some data !!!

Below is code and response from server.

(crossing fingers) Thanks for any replies.

Ext.onReady(function() {

var CatStore = new Ext.data.JsonStore({
url : "../getDepartments.php" ,
root : 'rows',
storeId : 'idCatStore',
fields : [
{ name : "department", mapping : "department" },
{ name : "numEmployees", mapping : "numEmployees" }

var idCatStore = new Ext.ListView({
store : CatStore,
singleSelect : true,
columns : [
header : 'Category',
dataIndex : 'department'
header : 'Count',
dataIndex : 'numEmployees',


new Ext.Window({
layout : 'fit',
height : 300,
width : 225,
items : idCatStore

({"rows":[{"department":"Pants","numEmployees":"665"},{"department":"Unsorted","numEmployees":"0"},{"department":"Headless","numEmployees":"6864"},{"department":"Solo with face","numEmployees":"2020"},{"department":"TwoPlus","numEmployees":"617"},{"department":"Funny ","numEmployees":"310"},{"department":"Commercial previews","numEmployees":"59"},{"department":"Eating","numEmployees":"406"},{"department":"Feeding","numEmployees":"122"},{"department":"Ppo","numEmployees":"424"},{"department":"Swallowing","numEmployees":"10"},{"department":"Oscar Winners","numEmployees":"13"},{"department":"Misc","numEmployees":"48"},{"department":"YouTube","numEmployees":"81"},{"department":"Puke","numEmployees":"73"},{"department":"Flies","numEmployees":"254"}] });

9 Nov 2010, 7:42 AM
Remove semi-colon from the end of the JSON response.

Why are you giving mapping property to your fields? Doesn't seem necessary since your using the same string for the columns name.

Also you might want to defined a successProperty on your store (which would change the required JSON response) as it certainly helps to have a success property when you start debugging complicated stores.

9 Nov 2010, 7:48 AM
Awesome, thank you.
(I remember reading about that now. Argh).

As for the rest, this is just hacked-up sample code, I am not doing anything except learning and verifying I can make the examples work. Real logic and data and design later.

Whew. On the the next show-stopper.