My code is not showing any error, my php file is responding also(firebug reports that). But the grid is not showing any data. I was trying to get help from http://dev.sencha.com/deploy/ext-3.4.0/examples/feed-viewer/view.html but unable to understand it!. The idea is to provide a rss feed url to program, and it should fetch data from that url and then php file arranges it in a proper xml format just like the ExtJS example(from above link), upto this point, program is working fine, firebug says that response is an xml, but now, it not load. Code:
var remoteProxy = new Ext.data.HttpProxy({
url : 'feed-proxy.php'
});
var store = new Ext.data.Store({
proxy : remoteProxy,
id : 'ourRemoteStore',
reader : new Ext.data.XmlReader({
record : 'item'
}, [{
name : 'title',
mapping : 'title'
}])
});
loadFeed = function(url) {
store.baseParams = {
feed : url
};
store.load();
console.log(store.getCount());
}
loadFeed('http://sports.yahoo.com/nba/rss.xml');
var mWIn = new Ext.Window({
title : 'My Window',
width : 500,
height : 400,
layout : 'fit',
items : [{
xtype : 'grid',
store : store,
id : 'myGrid',
loadMask : true,
columns : [{
id : 'title',
header : "Title",
dataIndex :'title',
sortable : true,
width : 420
}]
}]
}).show();
Ext.getCmp('myGrid').ownerCt.doLayout();
and php file code is :
<?php
// this is an example server-side proxy to load feeds
if(isset($_REQUEST['feed'])){
$feed = $_REQUEST['feed'];
if($feed != '' && strpos($feed, 'http') === 0){
header('Content-Type: text/xml');
$xml = file_get_contents($feed);
$xml = str_replace('<content:encoded>', '<content>', $xml);
$xml = str_replace('</content:encoded>', '</content>', $xml);
$xml = str_replace('</dc:creator>', '</author>', $xml);
echo str_replace('<dc:creator', '<author', $xml);
return;
}
}
?>