OK - no major modifications needed. I will stubbornly claim that the problem is in fact a cross-domain issue and to prove my point I have created a json-to-jsonp proxy that I will PM you the link for.
To show that it is working - in SA do the following:
1) Assign a Store to the Grid - select the Store you have in the project
2) In the JSONP proxy of the store, change the URL to the link for my proxy
3) Change the MyJsonReader to have a root property with the value "root"
4) Right-click the store and select Load Data
sa bcdata.jpg
The code for the PHP proxy I wrote is (crude with lots of error-checking missing, but the point is that the server hosting your Ext JS application polls the data from the BC trading server and converts it to JSONP - actually normal JSON would have been OK as well).
As the BC trading server is not producing JSONP, the cross-domain issue is encountered.
Code:
<?php
define('CACHE_FILE', '/tmp/bcproxy.tmp');
$cb = $_GET['callback']; // Ext.Ajax callback parameter
$get_data = false;
// Check if cached version exists and is younger than 5 minutes
if (!file_exists(CACHE_FILE)) {
$get_data = true;
}
else {
if (filemtime(CACHE_FILE) < (time() - 5*60)) {
$get_data = true;
}
}
// Prepare the answer
$result = array('success' => true);
// Read cache or request new data and write to cache
if ($get_data) {
$bcdata_raw = file_get_contents('http://bitcoincharts.com/t/markets.json');
$fp = fopen(CACHE_FILE, 'w+');
fwrite($fp, $bcdata_raw);
fclose($fp);
$result['cache_info'] = 'fetch';
}
else {
$bcdata_raw = file_get_contents(CACHE_FILE);
$result['cache_info'] = 'hit-' . (int)(time()-filemtime(CACHE_FILE)) . '-secs-old';
}
// Decode the answer from trading server and re-pack
$btdata = json_decode($bcdata_raw);
$result['root'] = $btdata;
// Send it!
header('Content-Type: text/javascript; charset=utf8');
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
echo $cb . '(' . json_encode($result) . ');';
Hope this helps you somehow.
/Mattias