PDA

View Full Version : XML not loading in grid from remote



dbinaz
15 Aug 2009, 8:17 PM
so here is my code. I have verified that the call to the api returns results. But I am not getting anything int he grid. I don't even see the call in firebug. When i do a local call to the same xml file still using http, then I get the data. I don't get it.



Ext.onReady(function(){


var jobData = new Ext.data.Store({
autoLoad: true, sortInfo: {field: 'date', direction: 'DESC'}, url: "http://api.indeed.com/ads/apisearch?publisher=xxxxxx&q=developer&l=&sort=&radius=&st=&jt=&start=0&limit=20&fromage=&filter=&latlong=1&co=us&chnl=main%20job%20page&userip=&useragent=", reader: new Ext.data.XmlReader({
id: "jobkey", record: "result", totalRecords: "totalresults", fields: [ "jobtitle","company","city","state","country",{
dateFormat: "D, d M Y H:i:s T", type: "date",
name: "date"
},"snippet","url" ]
},[
"jobtitle","company","city","state","country",{
dateFormat: "D, d M Y H:i:s T", type: "date",
name: "date"
},"snippet","url"
])
}); var myExpander = new Ext.grid.RowExpander({
tpl: new Ext.XTemplate(
"<tpl for=\".\"><div style=\"padding: 5px; line-height: 1.3; background-color:#fafad2\">{snippet} <a href=\"{url}\" target=\"_blank\">more...</a></div></tpl>"

)

}); var grid1 = new Ext.grid.GridPanel({
autoHeight: true, plugins: myExpander, renderTo: "grid-jobs", store: jobData, stripeRows: true, width: 686, bbar: new Ext.PagingToolbar({
displayInfo: true, pageSize: 20, store: jobData,
}) , columns: [ myExpander,{
dataIndex: "jobtitle", header: "Job Title", sortable: true, width: 261,
} ,{
dataIndex: "company", header: "Company", sortable: true, width: 150,
} ,{
dataIndex: "city", header: "City", sortable: true, width: 70,
} ,{
dataIndex: "state", header: "State", sortable: true, width: 50,
} ,{
dataIndex: "country", header: "Country", sortable: true, width: 50,
} ,{
dataIndex: "date", header: "Date", renderer: Ext.util.Format.dateRenderer('n/d/Y'), sortable: true, width: 100,
} ],
});

});

Animal
15 Aug 2009, 11:39 PM
If the page was not served from http://api.indeed.com then you won't be able to do it.

Browsers enforce a Same Origin Policy as a security measure.

These APIs usually have a script option which returns JSON wrapped in a call to a callback, so you can usually use a ScriptTagProxy.