create js function

<script>
function update_myrecords()
{web2py_component('{{=URL(r=request,c='default',f='show_foods')}}','mystuff'); 
};
</script>

then serverside

if form.accepts(...):
   response.headers['web2py-component-command']='update_myrecords()'
return form



On Apr 9, 7:12 pm, Avik Basu <avikb...@gmail.com> wrote:
> Say I have a form in component A and a records display in component
> B.  Both are loaded on a single page. How can I update the records
> display when the form (SQLFORM) accepts?
>
> On Apr 9, 6:19 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > Instead of
> > {{=LOAD('default','show_foods',ajax=True)}}
>
> > do
> > <div id="mystuff"><img src="...the loading indicator..."/></div>
> > <script>web2py_component('{{=URL(r=request,c='default',f='show_foods')}}',' 
> > mystuff')</
> > script>
>
> > You can also have
>
> > <button
> > onclick="web2py_component('{{=URL(r=request,c='default',f='show_foods')}}', 
> > 'mystuff')">click
> > me to reload</script>
>
> > On Apr 9, 5:07 pm, Avik Basu <avikb...@gmail.com> wrote:
>
> > > Hi,
>
> > > Is there a way to reload a component that has been loaded with the
> > > LOAD function without sending a request back to the server?
>
> > > For example, I would like to reload a list of foods whenever the data
> > > has been altered by the user, but I would like only the component to
> > > reload instead of the whole page.
>
> > > #in view
> > > {{=LOAD('default','show_foods',ajax=True)}}
>
> > > Also, is there a way to use a loading indicator icon instead of the
> > > default 'loading...' message?
>
> > > Thanks,
> > > Avik


-- 
To unsubscribe, reply using "remove me" as the subject.

Reply via email to