Pergunta

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?

Foi útil?

Solução

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'));

Outras dicas

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
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top