improve table resize event listeners.

This commit is contained in:
Christopher Jeffrey 2015-04-02 06:12:52 -07:00
parent b9a94f63ce
commit cf3eb09f9f
2 changed files with 7 additions and 12 deletions

View File

@ -6976,11 +6976,8 @@ function Table(options) {
this.setData(options.rows || options.data);
this.on('resize', function() {
var rows = self.rows;
// XXX Need to clear previous box.
self.setData([]);
self.screen.render();
self.setData(rows);
self.setContent('');
self.setData(self.rows);
self.screen.render();
});
}
@ -7027,7 +7024,7 @@ Table.prototype._calculateMaxes = function() {
};
Table.prototype.setRows =
Table.prototype.setData = function(rows, render) {
Table.prototype.setData = function(rows) {
var self = this
, text = ''
, line = ''
@ -7292,11 +7289,9 @@ function ListTable(options) {
this.setData(options.rows || options.data);
this.on('resize', function() {
var rows = self.rows;
// XXX Need to clear previous box.
self.setData([]);
self.screen.render();
self.setData(rows);
var selected = self.selected;
self.setData(self.rows);
self.select(selected);
self.screen.render();
});
}

View File

@ -15,8 +15,8 @@ var table = blessed.listtable({
align: 'center',
tags: true,
keys: true,
height: 5,
width: '80%',
height: '70%',
vi: true,
mouse: true,
style: {