문제

in a Grid example of 2012 the grid border is simply set with:

    TableElement _table;
    _table = new Element.tag("table");
    _table.border="1";

unfortunaltly border is no longer (running vers. 1.1.1) a setter in DART's TableElement class. Leaving it out results in a table without borders. How do I set a border?

도움이 되었습니까?

해결책

TableElement _table = new TableElement()
  ..setAttribute('border','1');

querySelector('body').append(_table);

or this should work also... I think

querySelector('body').append(new TableElement().setAttribute('border','1'));

다른 팁

This works for me

import 'dart:html';

void main() {
  TableElement q = querySelector('table');

  q.style
    ..border = '100px solid black';
}

Edit:

Ok I found out what's wrong, you are creating a new TableElement, not querying it from the dom:

TableElement _table;
_table = new Element.tag("table");
_table.style.border="100px solid black";
querySelector('body').append(_table); // add this line
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top