Ractivejs: How to get to work Nested propierties in view -


i have 2 objects results , headers being headers generated _.keys(result[0])

r{   data:{     headers:['head1','head2']     result:[       {head1:'content1',head2:'content2'}       {head1:'content3',head2:'content4'}       {head1:'content5',head2:'content6'}     ] } 

i have create table dinamically create this:

<table class="ui celled table segment">   <thead>     <tr>     {{#headers}}     <th>{{.}}</th>     {{/headers}}   </tr></thead>   <tbody>     {{#result:i}}     <tr>       {{#headers:h}}         <td>{{????}}</td> <-- here fail know put       {{/headers}}     </tr>     {{/result}}   </tbody> </table> 

can me fill in blanks. can create table display contents

if remove {{#headers}} part , know elements <td>{{.head1}}</td> work problem i'am generating direfent objects on fly

{{#result:i}}   <tr>     {{#headers:h}}       <td>{{result[i][this]}}</td>      {{/headers}}   </tr> {{/result}} 

the reason works <td> repeated each item in headers array, because it's inside headers section - far, obvious. because of that, can use this refer current header (head1, head2 etc). trick reference current row - , because you've created i index reference, can result[i]. hence result[i][this].

here's demo fiddle: http://jsfiddle.net/rich_harris/dkq5z/


Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -