this is at the the controller that loads the restaurant page

    callback = js.call_function(timer_tick, args=restaurant_id)

this is at the timer_tick

    restaurant_id=request.args(0)
    last_updates =
db((db.reviews.event_id==restaurant_id)&(db.reviews.created_on>session.last_check)).select(orderby=~db.reviews.created_on)

i just can't filter by restaurant_id because even with this query,
when there is a new comment in any restaurant, timer_tick updates all
the pages open of any restaurant

On Sep 1, 3:28 pm, "mr.freeze" <nat...@freezable.com> wrote:
> The value that you return from timer_tick will be eval'd by default.
> What do you want to do with the value from your db query in the UI?
>
> On Sep 1, 9:17 am, Francisco Costa <m...@franciscocosta.com> wrote:
>
>
>
>
>
>
>
> > please be more specific..
>
> > In timer_tick I do a db query, and I need to pass a value to succeed
> > on that query.
> > I could save the value in the session.value, but that wouldn't work
> > out when there are 2 pages open, that's why I want to pass it to
> > timer_tick
>
> > On Sep 1, 3:13 pm, "mr.freeze" <nat...@freezable.com> wrote:
>
> > > You can't pass arguments to exposed functions. Use the method(s) I
> > > outlined instead:
> > > def timer_tick():
> > >     if request.vars.my_var_passed_in_data:
> > >         ....
>
> > > I can be more specific if you tell me what you are trying to pass to
> > > timer_tick.
>
> > > On Sep 1, 8:57 am, Francisco Costa <m...@franciscocosta.com> wrote:
>
> > > > But i want to pass a value to the function timer_tick
> > > > something like this
>
> > > >     callback = js.call_function(timer_tick(arg))
>
> > > > but the function
> > > >     def timer_tick(arg):
>
> > > > doesn't load properly
>
> > > > On Sep 1, 2:02 pm, "mr.freeze" <nat...@freezable.com> wrote:
>
> > > > > If you're talking about the Client Tools module located 
> > > > > here...http://www.web2pyslices.com/main/slices/take_slice/8
> > > > > ...there is an 'data' parameter in event.listen that you can use. It
> > > > > can be a jQuery selector (default is 'form:first') and will show up in
> > > > > request.vars. If you don't need to grab the value of an element, then
> > > > > you can use the 'args' parameter and it will show up in request.args.
>
> > > > > On Sep 1, 6:44 am, Francisco Costa <m...@franciscocosta.com> wrote:
>
> > > > > > i have this autorefresh
>
> > > > > >     form = SQLFORM.factory(Field('AutoUpdates',
> > > > > > requires=IS_IN_SET(['On','Off']),default="On",
> > > > > > widget=SQLFORM.widgets.radio.widget))
> > > > > >     refresh.ready(jq("input[type='submit']").hide()())
> > > > > >     callback = js.call_function(timer_tick)
> > > > > >     refresh.ready(js.timer(callback,10000))
> > > > > >     event.listen('change',"input[name='timer']",timer_tick)
>
> > > > > > the thing is i want to call the function timer_tick with an argument
> > > > > > and the use it like this
>
> > > > > >     def timer_tick(arg):
> > > > > >         arg_passed=arg
>
> > > > > > How I do the js.call_function() and the event.listen()  ?

Reply via email to