This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
Attach events to your HTML
This example is about iteration and how to change the value of attributes.
The previous examples were only changing node values.
For each entry we get from the JSON we want a new link in the list.
| Player |
|---|
| Chloe |
In addition to the zebra iteration, this example shows a way to attach events by a directive.
To see those events in action, mouse-over the lines of the rendered table, and click on a line.
The HTML:
<table class="players 2">
<thead>
<tr>
<th class="player">Player</th>
</tr>
</thead>
<tbody>
<tr class="context">
<td class="player context">Chloe</td>
</tr>
</tbody>
</table>
The JSON data:
var data = ["Adrian Meador","Bryan Thomas", ... ,"Wendy Leatherbury"];
The Javascript to do this action (here with jQuery):
var directive = {
'tbody tr td[onclick]':
function(context,items, pos){
return 'lineClick(\''+items[pos]+'\');'
},
'tbody tr td[onmouseover]': '"swapStyle(this, true);"',
'tbody tr td[onmouseout]' : '"swapStyle(this, false);"',
'tbody tr td[style]':"'cursor:pointer'",
'tbody tr[class]':
function(context, items, pos){
var oddEven = (pos % 2 == 0) ? 'even' : 'odd';
var firstLast = (pos == 0) ? 'first': (pos == items.length -1) ? 'last':'';
return oddEven + ' ' + firstLast;
}
}
$('table.players.2').autoRender(data, directive);






