PDA

View Full Version : Loading grid with remote data



mjcon
27 Nov 2007, 9:18 AM
Guys, I'm baffled by how to get the grid to accept data (XML) sent via PHP executing on the same server.

If I tell my Store to use
url: 'approvals.xml'

it works fine and the grid shows data- BTW that XML file is a direct lift of the output returned by the PHP code.

If I create the store as follows:

var myproxy = new Ext.data.HttpProxy( {url: 'http://localhost:8089/mc/approvals/approvalsxml.php'} );
var ds = new Ext.data.Store({
// load using HTTP
proxy: myproxy ,
//url: 'approvals.xml',
// the return will be XML, so lets set up a reader
reader: new Ext.data.XmlReader({

record: 'approval'
}, Approval),

sortInfo:{field:'opp_ref_no', direction:'ASC'}
});
then I get a blank grid, even though Firebug shows me that data has been returned as I expected.

Am I missing something very obvious?
Thanks

mjlecomte
3 Dec 2007, 4:27 AM
Please use the php or the code tags when posting code, it makes it easier to view it and offer help.

Please post what the firebug console shows for the response when you use the XML file that you say works and the php file that you say does not work.

Also please repost your js file inside code tags or php tags.

You might just want to reply with two posts. One post have it be the js file and the firebug response that works. Make the other post the js file and the response that does not work.

tryanDLS
3 Dec 2007, 8:45 AM
Did you set the right content-type for the response?

3 Dec 2007, 8:49 AM
Just an FYI, JSON is much faster to parse than XML. Not too sure if you considered it yet. Just thought i'd pass it along :)

http://ajaxian.com/archives/json-vs-xml-the-debate

hendricd
3 Dec 2007, 9:08 AM
I believe your main page would also need to be served up from port:8089.