问题
data from server structured like:
var projects= [
{
name: 'project 1',
hours: 1,
},
{
name: 'project 1',
hours: 2,
},
{
name: 'project 1',
hours: 3,
},
{
name: 'project 1',
hours: 4,
},
{
name: 'project 1',
hours: 5,
},
{
name: 'project 1',
hours: 6,
},
{
name: 'project 1',
hours: 7,
},
{
name: 'project 2',
hours: 1,
},
{
name: 'project 2',
hours: 2,
},
{
name: 'project 2',
hours: 3,
},
{
name: 'project 2',
hours: 4,
},
{
name: 'project 2',
hours: 5,
},
{
name: 'project 2',
hours: 6,
},
{
name: 'project 2',
hours: 7,
}
];
With jquery template how do I created a table with a new row every 7th item?
I want to format like
<table>
<tr>
<td>project 1
<td>hours 1</td>
<td>hours 2</td>
<td>hours 3</td>
<td>hours 4</td>
<td>hours 5</td>
<td>hours 6</td>
<td>hours 7</td>
</tr>
<tr>
<td>project 2</td>
<td>hours 1</td>
<td>hours 2</td>
<td>hours 3</td>
<td>hours 4</td>
<td>hours 5</td>
<td>hours 6</td>
<td>hours 7</td>
</tr>
</table>
来源:https://stackoverflow.com/questions/14349672/jquery-template-create-new-row-every-nth-item