Thanks Dave, unfortunately I still haven't managed it. regards,
John On Tuesday, February 14, 2017 at 8:11:34 PM UTC+1, Dave S wrote: > > > > On Tuesday, February 14, 2017 at 2:55:30 AM UTC-8, John Philip wrote: >> >> Hi Ramon, >> >> since you've had experience using vuejs in web2py I thought I'd ask you. >> I am using a vuejs component library to display a table from a json >> dataset. >> >> var Main = { >> data() { >> return { >> tableData: get_json_data_from_web2py_table >> } >> }, >> methods: { >> formatter(row, column) { >> return row.task; >> }, >> filterTag(value, row) { >> return row.status === value; >> } >> } >> } >> var Ctor = Vue.extend(Main) >> new Ctor().$mount('#app') >> // configure language >> locale.use(en) >> >> my question is how can I pull the json data from the web2py database? >> Also similarly I would like to be able to edit/delete a record and push the >> changes to the web2py database. Do you have any suggestions? >> >> many thanks and regards, >> >> John >> > > Perhaps use the as_dict() operator > <URL: > http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#as_dict-and-as_list > > > and have a dot-json view rather than a dot-html view. > > Chapter 5 covers the views, but doesn't seem to spend much time on > non-HTML fllavors. You can get most of the way, maybe all the way, by > copying views/generic.json to your own file. > > /dps > > >> On Sunday, June 28, 2015 at 10:57:58 AM UTC+2, Ramos wrote: >>> >>> I dont use ractive. Only Vuejs and a template inside a script tag is >>> what i learned from the docs and video tutorials. >>> >>> Is the >>> >>> <script type="text/x-template" id="pote"> >>> <span class="label label-info">(%name%)</span> >>> <div> >>> <ul class="sortable-list"> >>> <li v-repeat="item:items|only name >>> "><macro-doses pote='(%name%)' mp='(%item%)' myid=(%name%) >>> items=(%items%)></macro-doses></li> >>> </ul> >>> </div> >>> </script> >>> >>> accepted by web2py without any compilation so vue can do its job? >>> >>> Regards >>> >>> 2015-06-28 9:23 GMT+01:00 Massimo Di Pierro <massimo....@gmail.com>: >>> >>>> I am not sure but I think you are mixing ractive and vue syntax. >>>> >>>> In ractive you have a <script/> and a <div id="target"/>. The script is >>>> rendered in the target. >>>> >>>> In vue (which you use), the ractive code is in place but you still use >>>> a script instead of a div. >>>> >>>> Massimo >>>> >>>> >>>> On Saturday, 27 June 2015 12:34:31 UTC-5, Ramos wrote: >>>>> >>>>> No help :) >>>>> Im doomed... >>>>> Em 26/06/2015 17:29, "António Ramos" <ramst...@gmail.com> escreveu: >>>>> >>>>>> Hello , >>>>>> so far so good i created my second vuejs page inside web2py and this >>>>>> time using components. >>>>>> >>>>>> >>>>>> my doformind.js has some components and changes the delimiters to >>>>>> avoid colision with curlies. >>>>>> >>>>>> Vue.config.delimiters = ['(%', '%)']; >>>>>> Vue.component('pote', { >>>>>> props: ['name','items'], >>>>>> template: '#pote' *<- refering to the html template inside my page* >>>>>> }); >>>>>> etc.... >>>>>> >>>>>> >>>>>> my html ... >>>>>> >>>>>> >>>>>> >>>>>> {{response.files.append(URL(r=request,c='static',f='/js/vue.min.js'))}} >>>>>> >>>>>> {{response.files.append(URL(r=request,c='static',f='/js/vue-resource.min.js'))}} >>>>>> {{response.files.append(URL(r=request,c='static',f='/js/toastr.js'))}} >>>>>> >>>>>> {{response.files.append(URL(r=request,c='static',f='/js/jquery-ui.js'))}} >>>>>> >>>>>> *{{response.files.append(URL(r=request,c='static',f='/js/doformind.js'))}}* >>>>>> >>>>>> {{response.files.append(URL(r=request,c='static',f='/css/toastr.css'))}} >>>>>> >>>>>> *{{response.files.append(URL(r=request,c='static',f='/css/doformind.css'))}}* >>>>>> {{extend 'layout.html'}} >>>>>> >>>>>> >>>>>> <script type="text/x-template" id="pote"> >>>>>> <span class="label label-info">(%name%)</span> >>>>>> <div> >>>>>> <ul class="sortable-list"> >>>>>> <li v-repeat="item:items|only name >>>>>> "><macro-doses pote='(%name%)' mp='(%item%)' myid=(%name%) >>>>>> items=(%items%)></macro-doses></li> >>>>>> </ul> >>>>>> </div> >>>>>> </script> >>>>>> >>>>>> >>>>>> .... >>>>>> .... >>>>>> somewhere in my page i have this component >>>>>> >>>>>> <pote name="1" items="(%items%)"></pote> >>>>>> >>>>>> >>>>>> >>>>>> All of this works very well outside web2py. >>>>>> >>>>>> Inside web2py i get a blank page and in chrome dev tools i see that >>>>>> <pote name="1" items="(%items%)"></pote> >>>>>> was translated to >>>>>> <pote name="1" items="[object Object],[object Object]"></pote> >>>>>> >>>>>> instead of >>>>>> >>>>>> <pote name="1"> >>>>>> <span class="label label-info">1</span> >>>>>> <div> >>>>>> <ul class="sortable-list ui-sortable"> >>>>>> </ul> >>>>>> </div></pote> >>>>>> >>>>>> the items object have to elements each a json object. >>>>>> >>>>>> What could be the problem ? >>>>>> >>>>>> I suspect that the >>>>>> >>>>>> <script type="text/x-template" id="pote"> >>>>>> is not being correctly interpteted. >>>>>> >>>>>> Any comments would be very appreciated. >>>>>> >>>>>> Thank you >>>>>> >>>>>> António >>>>>> >>>>>> -- >>>> 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+un...@googlegroups.com. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> -- 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.