1

来自服务器的数据结构如下:

  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,
        }
    ];

使用 jquery 模板,我如何创建一个每 7 项包含一个新行的表?

我想格式化

    <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>
4

0 回答 0