View Full Version : can't get extjs json grid to work

10 Aug 2010, 7:15 PM
I can't get this example to work I think it's outdated.
I tried downloading it to my harddrive and changing the paths and it still doesn't work.
with 3.2.1 Is there another working example.

<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Ext.PropertyGrid with JsonStore</title>
<link type="text/css" rel="stylesheet" media="all" href="ext-3.2.1/resources/css/ext-all.css (http://www.sencha.com/forum/view-source:" />
<script type="text/javascript" src="ext-3.2.1/adapter/ext/ext-base.js (http://www.sencha.com/forum/view-source:"></script>
<script type="text/javascript" src="ext-3.2.1/ext-all-debug.js (http://www.sencha.com/forum/view-source:"></script>

<div id="example-grid"></div>



var proxy=new Ext.data.HttpProxy( {url:'http://extjs.org.cn/extjs/examples/grid/survey.html'});
var reader=new Ext.data.JsonReader(
{name: 'appeId', mapping: 'appeId'},
{name: 'survId'}, //???name??mapping???,???????mapping
{name: 'location'},
{name: 'surveyDate'},
{name: 'surveyTime'},
{name: 'inputUserId'}
var store=new Ext.data.Store( {

// create the grid
var grid = new Ext.grid.GridPanel({
store: store,
columns: [
{header: "appeId", width: 60, dataIndex: 'appeId', sortable: true},
{header: "survId", width: 60, dataIndex: 'survId', sortable: true},
{header: "location", width: 60, dataIndex: 'location', sortable: true},
{header: "surveyDate", width: 100, dataIndex: 'surveyDate', sortable: true},
{header: "surveyTime", width: 100, dataIndex: 'surveyTime', sortable: true},
{header: "inputUserId", width:80, dataIndex: 'inputUserId', sortable: true}



11 Aug 2010, 4:54 AM
Please post code within code tags in the future.

you can't use an HTTP proxy for "outside domains". Read : http://en.wikipedia.org/wiki/Same_origin_policy

You need to use ScriptTagProxy

var proxy=new Ext.data.ScriptTagProxy( {url:'http://extjs.org.cn/extjs/examples/grid/survey.html'});

11 Aug 2010, 7:46 AM
I'm narrowing down the problem.
Changing that line request did not work.
I can't even get the original to work. The original has just "survey.html" not the entire path.

The example is here

I have saved the example on the desktop and it works from there but I have no idea how it is finding the survey.html file
since it's a relative link and survey.html is not on my desktop or in the json-grid_files folder and I see no base-href tag so this is a mystery to me.

It will not work however from my server folder (linux server) var/www after dragging it in there.
This is bizarre.



11 Aug 2010, 7:49 AM
i don't know what extjs.org.cn is!

11 Aug 2010, 8:10 AM
Are you saying this isn't part of extjs? Is there another example you could refer me to that's json to grid?


11 Aug 2010, 8:11 AM
That's a chinese site. I don't have a clue if that's even part of the Sencha company. try the official examples at http://sencha.com/deploy/dev/examples