PDA

View Full Version : Sanbox issue with proxy params?



benny
12 Mar 2008, 1:46 AM
I wonder if anyone knows a solution to this issue I'm having.

I'm building a Viewpont border layout inside a main Air window. I have active panels (center, east and south). I'm placing a grid panel inside each layout panel. I'm populating the grids with Json data via the HttpProxy.

The issue - when I attach a param to the URL, it works fine - but will not update param values in real time when a reload is called (the full URL seems to be cached) - I suspect this is just the way that works, and a param should be passed into the proxy separately.

When I pass the param into the proxy (not via the URL), I get a sandbox error in AIR, and it fails. 'Adobe AIR runtime security violation for JavaScript code in the application security sandbox (eval).

The snippet of code used is:


var proxyB = new Ext.data.HttpProxy({url: 'http://localhost/air_scripts/json_categories.php'});

var storeB = new Ext.data.Store({
proxy: proxyB,
reader: new Ext.data.JsonReader({
root:"records",
totalProperty: 'totalCount',
id:"id"
},
[{name: 'id', type: 'float'},{name: 'category_name'}]
)
});

proxyB.on('beforeload', function(p, params) {
params.fl = fromID;
});


Any suggestions on how I can reload a grid at runtime (updating a param in the datastore)?

many thanks.

benny
12 Mar 2008, 4:40 AM
For reasons that are not clear, I seem to have the params passing through fine now. I just tidied the code up a little (but still have the exact same concept) and it's working.

for reference, this is what I now have which works..



var proxyA = new Ext.data.HttpProxy({url: 'http://localhost/air_scripts/json_fromlocation.php'});


var dataStore = {

storeA : new Ext.data.Store({
proxy: proxyA,
reader: new Ext.data.JsonReader({
root:"records",
totalProperty: 'totalCount',
id:"id"
},
[{name: 'id', type: 'float'},{name: 'from_location'}]
)
})
// other stores
};



var dataGrid = {

gridA : new Ext.grid.GridPanel({
ds: dataStore.storeA,
columns: [{header: "From Location", width: 278, sortable: true, dataIndex: 'from_location'}],
stripeRows: true,
height:234,
})

// other grids

};


dataStore.storeA.load();


proxyB.on('beforeload', function(p, params) {
params.fl = fromID;
});



dataGrid.gridA.getSelectionModel().on('rowselect', function(){
fromID = dataGrid.gridA.getSelectionModel().getSelected().data.from_location;
dataStore.storeB.reload({params:{'fl': fromID}});
});

Juvs
24 Jun 2008, 1:22 PM
Did you have any full sample source code from you app, I trying to see how you create your sandbox and call lo the JsonReader with out getting the AIR security error.

I'm trying to do the same in a sample application, but always get the security error.