Re: [web2py] Re: component refresh with jQuery UI tab plugin

2011-07-13 Thread Richard Vézina
A lot of thing happen since that time... Here the solutions I found with
help of Anthony :

if form.accepts(request.vars, session):
session.flash = T('form accepted')
"""if table == 'ref_fnaregistry':
next = URL('ref', 'creation', args=1, extension=False,
host=True)
elif table == 'ref_vregistry':
next = URL('ref', 'creation', args=2, extension=False,
host=True)
elif table == 'ref_tregistry':
next = URL('ref', 'creation', args=3, extension=False,
host=True)
response.js = 'window.location.replace("%s")' % next""" # With
redirection (only a problem with the nav back arrow not working)
if table == 'ref_fnaregistry':
response.js="web2py_component('%s','two');" %
URL('ref','create_fvte',args='ref_vregistry')
response.js+="web2py_component('%s','three');" %
URL('ref','create_fvte',args='ref_tregistry')
elif table == 'ref_vregistry':
response.js="web2py_component('%s','three')" %
URL('ref','create_fvte',args='ref_tregistry')
elif table == 'ref_tregistry':
response.js="web2py_component('%s','four')" %
URL('ref','create_fvte',args='ref_eregistry') # Without "redirection" to
make sure the next coming component is updated

Note that the commented line breake the navigator workflow and the back
arrow not working... I do prefer to not redirect the user...

Thanks Cliff.


Richard



On Mon, Jul 11, 2011 at 6:20 PM, Cliff  wrote:

> Hello Richard,
>
> Your post and Massimo's reply helped me understand better how this is
> supposed to work.  So maybe I can return the favor a little bit.
>
> I understand from your posts that you have a field on tab_1 and you
> would like to see the contents of that field included in a dropdown on
> tab_2.  I'm assuming that if there is a value in this field it causes
> DAL to insert a row into some table.  Are these inserts actually
> taking place?  If they're not, I don't have an answer for that because
> I haven't tackled yet how to make a tab click do the work of a submit.
>
> On the other hand, if the values are getting into the required table
> and you don't see them in the drop down I may be able to help.  All of
> your LOAD calls point to the same 'create_fvte', which means that they
> are fetching the same load file from the view directory.  What's
> working for me so far is to have a separate load file for each tab,
> with a separate function to fetch and render the data.
>
> Please excuse my pseudocode.  What's working for me looks something
> like this:
>
>
> 
> Controller foobar.py:
> def foo():
>allfoos = db.foo.select(id>0)
>return dict(allfoos=allfoos)
>
> def bar():
>allbars = db.bar.select(id>0)
>return dict(allbars = allbars)
>
>
> --
> view foo.load:
> {{for eachfoo in allfoos:}}
>{{ # do something }}
> {{pass}}
>
>
> --
> view foobar.html
> .
> .
> .
> 
>
>{{=T('foo').capitalize()}}
>{{=T('bar').capitalize()}}
> 
>
> {{=LOAD(c='foobar', f='foo', ajax=True, target='tabs-1')}}
>
>
>{{=LOAD(c='foobar', f='bar', ajax=True, target='tabs-2')}}
>
> .
> .
> .
> Good luck.
>
> On Jun 6, 11:32 am, Richard Vézina 
> wrote:
> > Hello Massimo,
> >
> > Was it available in 1.94.6??
> >
> > I try all sort of things and can't makes it work... No refresh.
> >
> > Richard
> >
> > On Fri, Jun 3, 2011 at 10:02 AM, Massimo Di Pierro <
> >
> >
> >
> >
> >
> >
> >
> > massimo.dipie...@gmail.com> wrote:
> > > Give a name to your components
> >
> > > {{=LOAD(...,target='one')}}
> > > {{=LOAD(...,target='two')}}
> > > {{=LOAD(...,target='three')}}
> >
> > > now any action can trigger a component reload
> >
> > > response.js="web2py_component('action','target')"
> >
> > > where action is the URL of the component and 'target' is 'one', 'two',
> > > 'three'', etc.
> >
> > > On Jun 2, 4:21 pm, Richard Vézina  wrote:
> > > > Hello,
> >
> > > > Here my view code :
> >
> > > > {{extend 'layout_form.html'}}
> >
> > > > 
> > > > @import
> >
> > >
> "{{=URL('static','plugin_added/jquery-ui-1.8.9.custom/development-bundle/th
> > > emes/base/jquery.ui.all.css')}}";
> > > > 
> >
> > > >  >
> > >
> src="{{=URL('static','plugin_added/jquery-ui-1.8.9.custom/js/jquery-1.4.4.m
> > > in.js')}}">
> > > >  >
> > >
> src="{{=URL('static','plugin_added/jquery-ui-1.8.9.custom/development-bundl
> > > e/ui/jquery.ui.core.js')}}">
> > > >  >
> > >
> src="{{=URL('static','plugin_added/jquery-ui-1.8.9.custom/development-bundl
> > > e/ui/jquery.ui.widget.js')}}">
> > > >  >
> > >
> src="{{=URL('static','plugin_added/jquery-ui-1.8.9.custom/development-bundl
> > > e/ui/jquery.ui.tabs.js')}}">
> > > > 
> > > > $(fu

Re: [web2py] Re: component refresh with jQuery UI tab plugin

2011-06-06 Thread Richard Vézina
Hello Massimo,

Was it available in 1.94.6??

I try all sort of things and can't makes it work... No refresh.

Richard

On Fri, Jun 3, 2011 at 10:02 AM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> Give a name to your components
>
> {{=LOAD(...,target='one')}}
> {{=LOAD(...,target='two')}}
> {{=LOAD(...,target='three')}}
>
> now any action can trigger a component reload
>
> response.js="web2py_component('action','target')"
>
> where action is the URL of the component and 'target' is 'one', 'two',
> 'three'', etc.
>
>
>
> On Jun 2, 4:21 pm, Richard Vézina  wrote:
> > Hello,
> >
> > Here my view code :
> >
> > {{extend 'layout_form.html'}}
> >
> > 
> > @import
> >
> "{{=URL('static','plugin_added/jquery-ui-1.8.9.custom/development-bundle/th
> emes/base/jquery.ui.all.css')}}";
> > 
> >
> >  >
> src="{{=URL('static','plugin_added/jquery-ui-1.8.9.custom/js/jquery-1.4.4.m
> in.js')}}">
> >  >
> src="{{=URL('static','plugin_added/jquery-ui-1.8.9.custom/development-bundl
> e/ui/jquery.ui.core.js')}}">
> >  >
> src="{{=URL('static','plugin_added/jquery-ui-1.8.9.custom/development-bundl
> e/ui/jquery.ui.widget.js')}}">
> >  >
> src="{{=URL('static','plugin_added/jquery-ui-1.8.9.custom/development-bundl
> e/ui/jquery.ui.tabs.js')}}">
> > 
> > $(function() {
> > $( "#tabs" ).tabs();});
> >
> > 
> >
> > 
> > 
> > 
> > 
> > 
> > 
> > {{=T('folder').capitalize()}}
> > {{=T('volume').capitalize()}}
> > {{=T('tome').capitalize()}}
> > {{=T('report').capitalize()}}
> > 
> > 
> > 
> >
> >
> {{=LOAD(c='ref',f='create_fvte',args='ref_fnaregistry',extension='load',aja
> x=True,ajax_trap=False)}}
> > 
> > 
> > 
> >
> >
> {{=LOAD(c='ref',f='create_fvte',args='ref_vregistry',extension='load',ajax=
> True,ajax_trap=False)}}
> > 
> > 
> > 
> >
> >
> {{=LOAD(c='ref',f='create_fvte',args='ref_tregistry',extension='load',ajax=
> True,ajax_trap=False)}}
> > 
> > 
> > 
> >
> >
> {{=LOAD(c='ref',f='create_fvte',args='ref_eregistry',extension='load',ajax=
> True,ajax_trap=False)}}
> > 
> > 
> >
> > 
> >
> > The problem is that when the form loaded with component in tab-1 is
> submited
> > and the user clic on tab-2 to fill the following form... The component is
> > not up to date... So the new entry just made into the preceding form is
> not
> > available to be pick in the second form dropbox...
> >
> > Is there a way to send a refresh component command on tab-2 clic or
> > something?? Or the only solution be to add a refresh button that to force
> > component reload??
> >
> > Thanks
> >
> > Richard
>