I've not verified the code but something along the lines of:

<script>
   var rec = 
JSON.parse('{{=json.dumps(db(db.xyz.id>0).select().as_list())}}');
</script>

You could then write some javascript to populate block 2 using the rec 
object created...

On Sunday, 19 May 2013 11:32:40 UTC+8, Lio wrote:
>
> Hello there,
>
> I have two DIV blocks on my page, one is a list of matched data records 
> list (only a few fields each row) using <ol><li>, the other is detail 
> record info when a record in above list is clicked. I want to use jQuery to 
> update the content in the Block 2 whenever a record is clicked, without 
> refreshing the whole page. 
>
> Block 1
> ========================================
> 1. Record #1                                                            |
> 2. Record #2                                                            |
> ...                                                                       
>     |
> ========================================
>
> Block 2
> ========================================
> field 1:                                                                   
>    |
> field 2:                                                                   
>    |
> .........                                                                 
>      |
> ========================================
>
> Here is the question:
> A query was executed to create the list of records, and all records are 
> already returned to View, How can I store all matched data records and pass 
> the clicked one to jQuery functions? Otherwise I have to pass the record id 
> to controller via ajax and execute another query and return it back to 
> Block 2 every time a record row is clicked. This seems to be very 
> inefficient. 
>
> Any suggestion is appreciated.
>
> Lio
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to