简体   繁体   中英

How to recive JSON data from odoo controller to a specific js file (ExtJS)

I want to add a bryntum schedule (ExtJS framework) to my odoo module but I have problem with transferring data from and to its js file

my controller :

@http.route('/testjs', type="json", auth='public', website=True)
    def test(self):    
    return [{'name': 'amor', 'age': '20'},           
           {'name': 'james', 'age': '21'}]

and the js file is part which receives data:

 var resourceStore = new Sch.data.ResourceStore({   
         model   : 'Sch.model.Resource'});
 
 resourceStore.loadData([  //static data for test  
     {        Id      : 'a',        Name    : 'Rob'    },    
     {        Id      : 'b',        Name    : 'Mike'    }]);

note: I think I should use a proxy, but I don't know how

you can try something like

$.getJSON('/testjs?',
    function(data) { ... }
);

for more info http://api.jquery.com/jQuery.getJSON/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM