Brad Parks Brad Parks - 1 month ago 9
Node.js Question

Blessed ListTable - Top row locked, cant select or scroll

I'm new to blessed, and have a

listTable
that doesn't seem to scroll it's top line.

Here's a GIF of the problem I see happing - the top line doesnt scroll.



https://asciinema.org/a/eodiry1mw59jx7wqrgvq1dwvs

Any suggestions?

var blessed = require('blessed');
var screen = new blessed.Screen

// Function to create a bunch of sample data
function getData(start, count) {
var result = [];
for (var i=start; i < count; i++) {
var row = [ '', i+'', 'test' + i];
result.push(row);
}
return result;
}

// quit when q or Ctrl-q is pressed
screen.key(['q','C-q'], function() {
return process.exit(0);
});

// Create a table
var table = blessed.listtable({
parent: screen,
left: 0,
data: getData(0,100),
border: 'line',
align: 'center',
keys: true,
width: '90%',
height: '90%',
vi: false,
name:'table'
});

// Focus table, and render results to screen
table.focus();
screen.render();

Answer

The reason is that the first row acts as the header for the table and it stays in a fixed position for convenience.

You will probably need to make your own custom ListTable class if you do not want the header since it is currently not optional. It's fairly easy to do though, just remove the relevant bits from the existing class that reference the fixed header (see the commented out bits here).

Comments