私は Windows で ExtJs 4.2.2 を使用しており、Python スクリプトを実行して json データをロードしたいと考えています。ドキュメントの例に従っていますが、理解できないエラーに直面しています: 私のストアは、応答を取得するために Python スクリプトを実行していないようです。代わりに、ソース コードを json ファイルとして読み込もうとします。 .
test.py :
#!C:\Python27\python.exe
import json
print "Content-type: application/json\n\n"
print("{\"text\":\".\",\"UserStories\":[{\"id\": \"1\", \"State\":\"hello\", \"headline\": \"world\", \"category\": \"rien\"}]}")
私の店 TreeGrid.js:
Ext.define
(
'CMS.store.TreeGrid',
{
extend: 'Ext.data.TreeStore',
model: 'CMS.model.TreeGrid',
storeId: 'TreeGrid',
autoLoad: false,
autoSync: true,
proxy:
{
type: 'ajax',
url: 'pythonScripts/test.py',
reader:
{
type: 'json',
root: 'UserStories'
},
},
folderSort: true
}
);
私のコントローラーの機能:
onRequest: function()
{
var myStore = this.getTreeGridStore();
myStore.load
(
{
scope: this
}
);
Ext.Ajax.request
(
{
url: 'pythonScripts/test.py',
success: function(response, opts)
{
var obj = Ext.decode(response.responseText);
console.dir(obj);
},
failure: function(response, opts)
{
console.dir('server-side failure with status code ' + response.status);
}
}
);
}
そして、これが FireBug で得た応答です: http://www.sencha.com/forum/attachment.php?attachmentid=46630&d=1383130677
スクリプトを実行していない理由がわかりませんが、生のコードを取得しようとしています。どんな助けでも大歓迎です、ありがとう。