mootools/mootools-more — Issue #1049: HtmlTable method: empty fails on empty table
Author: DrHofman
Created: 2011-10-14 04:05:00+00:00
State: open

Hello,

Calling myTable.empty(); on an already empty HtmlTable you get this error

```Uncaught TypeError: Cannot call method 'isDisplayed' of undefined```

tracked it to the selectRange function for loop

```
for (var i = startRow; i <= endRow; i++){
if (this.options.selectHiddenRows || rows[i].isDisplayed()) this[method](rows[i], true);
}
```

Here is a quick fix:

```
for (var i = startRow; i <= endRow; i++){
if (rows[i] && (this.options.selectHiddenRows || rows[i].isDisplayed())) this[method](rows[i], true);
}
```

All the best
Daniel