There is the solution to pass the table.id as an argument and then
make an additional query to the database in tables_info to get the
table but i don't like this solution because i already have the row
from a previous query.

An extra question, now in the div i present inside index

<div class="tables_info">
  {{=type(table)}}
  {{=table.key}}
</div>

i add an

{{=A("Like", _href=URL('default', 'like', extension=False))}}

which is a function in another controller ('default') that changes the
value of 'like' (is a field of table like {{=table.key}} in the above
example)
How do i trigger the refresh of the div? The example in the book has a
submit form that refreshes the page, but in my case there is not but
still a value has changed. I guess that i should do something in my
like function

in default.py

def like():
    table_id = request.args(0)
    table = db.my_table[table_id]
    like = table.like + 1
    table.update_record(like=like)
    # something here ??????

Thanks for all the help






On Dec 6, 11:22 am, thodoris <pasxi...@gmail.com> wrote:
> I am trying to use the LOAD component and i have some questions. I
> would like to pass an argument to the LOAD function which is a table
> row but it is converted to a string and i can't access the row
> attributes. There is a way to pass them by value but i would prefer to
> pass the row instead (or a dictionary if possible). So
>
> in my index.html i have
>
> # where my_tables = db().select(db.my_tables.ALL) is returned from
> default/index
>
> {{for table in my_tables:}}
>   {{=LOAD('info', 'tables_info.load', vars={'table':table},
> ajax=True)}}
> {{pass}}
>
> i have defined the controller tables_info in info.py to return the the
> dictionary that it gets
>
> def tables_info():
>     table = request.vars.table
>     return dict(table=table)
>
> And i have also defined the view info/tables_info.load where is the
> things that i would like to present
>
> <div class="tables_info">
>   {{=type(table)}}
>   {{=table.key}}
> </div>
>
> Here i can't access the table.keys cause table is of type <str>. What
> can i do in this case?

Reply via email to