[web2py] web2py with js framework

2017-08-13 Thread Carlos Kitu
Hi stifan,
I just wanted to share my recent experience with vue.js and web2py.
At first I didn't want to give up things like sqlform.
Then I tried to tweak the form generated by web2py with el1=form.element(...) 
to get a reference to the html element I wanted to add certain vue.js 
directives like v-if, v-model, ...
It was so easy as:
el1["_v-if"]="something"

It works but later I realized that it was not practical because I the logic 
spread between the controller, with the form generation, and vue.js directives, 
then the html view where I had more vue.js directives and components, and the 
main js vue controller. 

As I didn't want to renounce to the look and feel of web2py, because I just 
needed a very dynamic function made in vue, and the rest of the application 
could be made the traditional way with web2py, I resorted to generating just 
once the form with web2py and copying manually the resulting html code to the 
html view, and that way I just have to work with the html view and the JS code 
as usual in vue.js apps.
With regard to passing data from the controller to vue.js, you can use 
{{=ASSIGNJS(key1=val1, key2=val2, ...)}} in your view and you will get those 
keys available as global vars in JavaScript with the needed translations to 
JSON in case you use complex values as lists, dicts, ...

If anybody found a better way to integrate the things, please let us know.

Hope this helps.
Best regards.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] web2py with js framework

2017-08-08 Thread 黄祥
is there any simple web2py app with js framework (whatever) that have a 
CRUD or GRID example?
want to learn to combine it, but confuse, what is web2py job (define 
models, provide restful api, any others ?), what is js framework job 
(client side response) ? how about the form handling (web2py or js job?)
some of dev in here talk about vuejs, so i just look at it and learn from 
the example
https://vuejs.org/v2/examples/grid-component.html

but again, don't know how to connect it with web2py, any hints or example 
maybe.

thanks and best regards,
stifan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.