Skip to content
Snippets Groups Projects
Commit 6f7b2a89 authored by Renaud Le Gac's avatar Renaud Le Gac
Browse files

Expose public methods of the cfgSvc service in such a way that they can be used on the client side.

Rely on the Ext.Direct technology.
parent 4613af20
No related branches found
No related tags found
No related merge requests found
......@@ -87,4 +87,8 @@ def index():
# page view
response.view = "applayout.html"
return dict(clibs=csslibs, jlibs=jslibs, alibs= applibs, appdebug= debug)
\ No newline at end of file
return dict(clibs=csslibs,\
jlibs=jslibs,\
alibs= applibs,\
appdebug=debug,\
cfgSvcMethods=cfgSvc._getMethods())
\ No newline at end of file
/**
* direct_1.js
* Script to test Ext Direct
*
* $Id$
*
*/
Ext.onReady(function(){
Ext.QuickTips.init();
console.log("Remote API")
console.dir(App.cfgSvcMethods);
Ext.Direct.addProvider(App.cfgSvcMethods);
console.log("direct_1");
console.log("cfgSvc.getTables()")
cfgSvc.getTables(function(provider, response){
console.log("provider getTables");
console.log(provider);
// console.log("response");
// console.dir(response);
});
console.log("cfgSvc.getFormModel(table)")
cfgSvc.getFormModel("distributions", function(provider, response){
console.log("provider getFromModel");
console.dir(provider);
// console.log("response");
// console.dir(response);
});
console.log("cfgSvc.getGridModel(table)")
cfgSvc.getGridModel("distributions", function(provider, response){
console.log("provider getGridModel");
console.dir(provider);
// console.log("response");
// console.dir(response);
});
});
\ No newline at end of file
......@@ -19,11 +19,18 @@
{{for el in jlibs:}}
<script type="text/javascript" src="{{=el}}"></script>{{pass}}
<!-- Namespace and global variables for the application -->
<!-- Namespace, global variables and remote methods for the application -->
<script type="text/javascript">
Ext.namespace('App');
App.name = '{{=request.application}}';
App.debug = {{=str(appdebug).lower()}};
App.cfgSvcMethods = {
"url": '/{{=request.application}}/foo',
"type":"remoting",
"actions": {
"cfgSvc": {{=cfgSvcMethods}}
}
};
</script>
<!-- application scripts -->
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment