View Full Version : grid:i can't get the data

12 Nov 2009, 1:46 AM
code below:

var sql_data = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: '../data/response_data.aspx'
reader: new Ext.data.JsonReader({
root: 'data'
}, [
{ name: 'released', type: 'date', dateFormat: 'Y-m-d' },
{ name: 'price', type: 'float' },
{ name: 'active', type: 'bool'}
var edit_grid = new Ext.grid.EditorGridPanel({
renderTo: document.body,
height: 500,
store: sql_data,
clicksToEdit: 1,
sm: new Ext.grid.RowSelectionModel({ singleSelect: false }), //????????
columns: [
{ header: 'Title', dataIndex: 'title', sortable: true, editor: title_edit, width: 100 }, //??sortable??????
{ header: 'Director', dataIndex: 'director', editor: director_edit, width: 180 },
{ header: 'Released', dataIndex: 'released', editor: released_edit, renderer: Ext.util.Format.dateRenderer('Y-m-d'), width: 100 },
{ header: 'Genre', dataIndex: 'genre', width: 70, editor: combo_edit },
{ header: 'Tagline', dataIndex: 'tagline', width: 200 },
{ header: 'Price', dataIndex: 'price', width: 100 }

'response_data.aspx output:

{"data":[{"id":1,"title":"Office Space","director":"Mike Judge","released":"1999-2-19 0?00?00","genre":1,"tagline":"Work Sucks","coverthumb":"84m.jpg","price":19.95,"available":1},

but now ,no data show in grid ,that's why? Thank you very much!
(my poor English :s)

12 Nov 2009, 7:02 AM
Is your JSON valid? [ http://jsonlint.com ]

Try adding load and exception handlers to your store to see which one fires. If the exception handler fires, take a look in firebug/firefox to see what is wrong.

12 Nov 2009, 5:51 PM
To carol.ext:
Thank you very much!!!! There is indeed a problem of JSON,

{"id":5,"title":"The Big Lebowski","director":"Joel Coen","released":"1998-3-6 0?00?00","genre":1,"tagline":"The \\Dude\\","coverthumb":"49m.jpg","price":21.9,"available":1 (file://\\Dude\\","coverthumb":"49m.jpg","price":21.9,"available":1)}

Double quotes existed in the database,delete them and the problem is resolved.
by the way, if I need Double quotes,how can i do?
for example:
original data is "The Dude", but I need them exist in database like The "Dude" ,and I hope it can be successfully parsed by JSON, how should I write in database?