I started using "Mustache JS" a few hours ago. I wonder if there is a way to add a class to tr to make the table striped. I know that I can determine if the value of a variable is null or undefined, but it is not. The variable will always have a value. Is there any way to do this?
I got the following code:
Template:
template = "\
{{#tr}}\
<tr>\
<td>{{tit}}</td>\
<td>{{ord}}</td>\
<td>{{prazo}}</td>\
<td>{{id}}</td>\
</tr>\
{{/tr}}";
View:
view = {
"tr" : [
{
id : val.ID,
ord : val.Ordem,
prazo : val.Prazo,
tit : val.Título
}
]
};
I know that I can set a function in a view. But dunno, how to properly install the mod inside it, for alternation. Any help would be great.
source
share