[web2py] Re: js.call_function with arguments

2010-09-01 Thread mr.freeze
Something like this maybe?: def restaurants(): restaurant_id = ... event.listen('change',"input[name='timer']",timer_tick,args=restaurant_id) def timer_tick(): restaurant_id=request.args(0) last_updates = db(...) if last_updates: new_rows = [TR(update) for update in last

[web2py] Re: js.call_function with arguments

2010-09-01 Thread Francisco Costa
Any help? I'm becoming desperate for a solution that works :/ On Sep 1, 3:42 pm, Francisco Costa wrote: > 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.ar

[web2py] Re: js.call_function with arguments

2010-09-01 Thread Francisco Costa
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(o

[web2py] Re: js.call_function with arguments

2010-09-01 Thread Francisco Costa
My app has some restaurants. I have a restaurant for each page where you can comment or leave a review. I'm using timer_tick to query if there are newer reviews after you open the page every 10seconds. If there is, timer_tick returns those reviews. The problem I'm having is when I have 2 restaurant

[web2py] Re: js.call_function with arguments

2010-09-01 Thread mr.freeze
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 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.

[web2py] Re: js.call_function with arguments

2010-09-01 Thread Francisco Costa
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" wrote: > Y

[web2py] Re: js.call_function with arguments

2010-09-01 Thread mr.freeze
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 wrote: > But i want t

[web2py] Re: js.call_function with arguments

2010-09-01 Thread Francisco Costa
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" wrote: > If you're talking about the Client Tools module located > here...

[web2py] Re: js.call_function with arguments

2010-09-01 Thread mr.freeze
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 th