动态添加到Vaadin网格

时间:2016-11-17 17:45:21

标签: polymer vaadin vaadin-grid

动态添加列时,如何在网格标题中设置<th>

 <vaadin-grid id="grid">
         <table>
          <colgroup>
          </colgroup>
          <thead>
            <tr>
              <th>adfdfa</th>
              <th>adfdfa</th>
            </tr>
          </thead>
        </table>
      </vaadin-grid>


  _addCols: function() {
    var inputs = this.selectedForm.inputs;
    var grid = this.$.grid;
    grid.columns = [];
    for(var i = 0; i < inputs.length; i++) {
      var input = inputs[i];
      grid.addColumn({name: input.$key}, i); 
    }
  },

1 个答案:

答案 0 :(得分:1)

无论在文档中发现这一点。

 grid.header.getCell(0, 0).content = 'Project Name';

Documentation