All,
I have a row of data that needs to iterate over multiple tr's.
Data:
var data = {
news:[
{ headline:'HEAD A', story:'aaaaaa'},
{ headline:'HEAD B', story:'bbbbbb'},
{ headline:'HEAD C', story:'cccccc'}
]
};
And the HTML:
<table border="1">
<tbody>
<tr class="line1">
<td class="headline"></td>
</tr>
<tr class="line2">
<td class="story"></td>
</tr>
</tbody>
</table>
(My actual template is a little more complicated but this is great for a sample).
When the directive is to just loop over tbody it works, but, adds a tbody around the two tr's which is not ideal.
Is there anyway to do this cleanly?
Thanks,
Sam
FULL CODE:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
<html lang="en">
<head>
<title></title>
</head>
<html>
<body>
<table border="1">
<tbody>
<tr class="line1">
<td class="headline"></td>
</tr>
<tr class="line2">
<td class="story"></td>
</tr>
</tbody>
</table>
<script>
var data = {
news:[
{ headline:'HEAD A', story:'aaaaaa'},
{ headline:'HEAD B', story:'bbbbbb'},
{ headline:'HEAD C', story:'cccccc'}
]
};
$p('table').render(data, {
'tbody':{
'row<-news':{
'td.headline':'row.headline',
'td.story':'row.story'
}
}
});
</script>
</body>
</html>