PDA

View Full Version : What 's the different of HttpProxy and ScriptTagProxy



redalerthan
6 Jun 2007, 6:23 AM
Partial code in grid.js:

var ds = new Ext.data.Store({
// HttpProxy should be used here
proxy: new Ext.data.ScriptTagProxy({url: 'grid-paging-data.php'}),
reader: new Ext.data.JsonReader({root: 'results',totalProperty: 'total'}, [
{name: 'OrderID', mapping: 'OrderID'},
{name: 'ProductID', mapping: 'ProductID'},
{name: 'UnitPrice', mapping: 'UnitPrice'},
{name: 'Quantity', mapping: 'Quantity'},
{name: 'Discount', mapping: 'Discount'}
]),
// turn on remote sorting
remoteSort: true
});
ds.setDefaultSort('OrderID', 'desc');

This is work for the grid, while when I change the proxy to HttpProxy, the grid get no data.
entironment:winxpsp2+iis5+php5+mysql5+ie7, php file and .js file located in the root of wwwroot.
What 's the problem ?

perrich
6 Jun 2007, 11:37 AM
Maybe your JSON result is bad :
Change IE7 and use Firefox + firebug => You can debug, show received JSON result and be notified after each error.

I've a similar script and if ScriptTagProxy is supported, HTTPProxy works also (and must be used, if you doesn't need a cross domain request).

Animal
6 Jun 2007, 12:43 PM
Maybe your JSON result is bad :
Change IE7 and use Firefox + firebug => You can debug, show received JSON result and be notified after each error.

I've a similar script and if ScriptTagProxy is supported, HTTPProxy works also (and must be used, if you doesn't need a cross domain request).

A server script can be made to work for both, but you need to code for it.

The server is contacted by ScriptTagProxy by creating... guess what? a <script> tag with the src set to the URL you specify.

So what you return must be executable javascript code, not just an object.

This is made clear if you read the documentation: http://extjs.com/deploy/ext-1.1-beta1/docs/output/Ext.data.ScriptTagProxy.html

redalerthan
11 Jun 2007, 8:04 PM
Hi All, I am newbie for both ext and php, I use the tutorial for paging grid located in http://www.vinylfox.com/extjs/examples/grid-paging.zip, I just change the mysql server to local and change ScriptTagProxy to HttpProxy, it not work, is there any change I have to do for the grid-paging-data.php ?

perrich
11 Jun 2007, 11:35 PM
Could you compare http://extjs.com/forum/topics-remote.php?start=0&limit=25&_dc=1181633461171&callback=stcCallback1001 and your grid-paging-data.php result ?