Как добавить строки в TableElement в Dart?

Я играю с Dart и пытаюсь создать новый TableElement с заголовком и одной строкой в ​​tbody.

  TableElement table = new TableElement();

  Element head = table.createTHead();
  TableRowElement headerRow =  table.tHead.insertRow(-1);
  headerRow.insertCell(0).text = "9";
  headerRow.insertCell(1).text = "aaa";
  headerRow.insertCell(2).text = "bbb";
  headerRow.insertCell(3).text = "ccc";

  var tBody = table.createTBody();
  TableRowElement newLine = table.insertRow(-1); // add at the end
  newLine.insertCell(0).text = "9";
  newLine.insertCell(1).text = "aaa";
  newLine.insertCell(2).text = "bbb";
  newLine.insertCell(3).text = "ccc";

К сожалению, обе строки заканчиваются в разделе thead. Кроме того, если я оставлю только

  TableElement table = new TableElement();

  var tBody = table.createTBody();
  TableRowElement newLine = table.insertRow(-1); // add at the end
  newLine.insertCell(0).text = "9";
  newLine.insertCell(1).text = "aaa";
  newLine.insertCell(2).text = "bbb";
  newLine.insertCell(3).text = "ccc";

строка попадает в раздел tbody, как и ожидалось. Любые идеи? Дарт SDK 9474.

6
задан Brian Tompsett - 汤莱恩 17 July 2017 в 09:12
поделиться