0

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?

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
Martin
  • 1,430
  • 10
  • 19
  • 2
    _table.style.border = "1"; – Ozan Feb 08 '14 at 17:41
  • Does not work, alas. In Debug: _table.style.border = "0"; changes border to "0px". _table.style.border = "1"; changes border to "". _table.style.border = "1px"; changes border to "1px". But no border is shown. – Martin Feb 09 '14 at 21:32

2 Answers2

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
Faris Nasution
  • 3,450
  • 5
  • 24
  • 29
1
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'));
doodeec
  • 2,927
  • 19
  • 23
  • The first (..setAttribute) works. Did not try the second one, as I already have a
    that holds my table, using ..clear ..addAll
    – Martin Feb 11 '14 at 18:57