如何从 odoo 控制器接收 JSON 数据到特定的 js 文件 (ExtJS)
How to recive JSON data from odoo controller to a specific js file (ExtJS)
我想向我的 odoo 模块添加一个 bryntum 计划(ExtJS 框架),但我在与它的 js 文件之间传输数据时遇到问题
我的控制器:
@http.route('/testjs', type="json", auth='public', website=True)
def test(self):
return [{'name': 'amor', 'age': '20'},
{'name': 'james', 'age': '21'}]
js文件是接收数据的部分:
var resourceStore = new Sch.data.ResourceStore({
model : 'Sch.model.Resource'});
resourceStore.loadData([ //static data for test
{ Id : 'a', Name : 'Rob' },
{ Id : 'b', Name : 'Mike' }]);
注意:我想我应该使用代理,但我不知道如何
你可以试试
$.getJSON('/testjs?',
function(data) { ... }
);
我想向我的 odoo 模块添加一个 bryntum 计划(ExtJS 框架),但我在与它的 js 文件之间传输数据时遇到问题
我的控制器:
@http.route('/testjs', type="json", auth='public', website=True)
def test(self):
return [{'name': 'amor', 'age': '20'},
{'name': 'james', 'age': '21'}]
js文件是接收数据的部分:
var resourceStore = new Sch.data.ResourceStore({
model : 'Sch.model.Resource'});
resourceStore.loadData([ //static data for test
{ Id : 'a', Name : 'Rob' },
{ Id : 'b', Name : 'Mike' }]);
注意:我想我应该使用代理,但我不知道如何
你可以试试
$.getJSON('/testjs?',
function(data) { ... }
);