NeXTs / Clusterize.js

Tiny vanilla JS plugin to display large data sets easily
https://clusterize.js.org
MIT License
7.22k stars 412 forks source link

Wrong cell width with fixed table #53

Closed jbanety closed 8 years ago

jbanety commented 9 years ago

Hi,

My table is rendered with a fixed layout. My cells are all sized with a specific width.

When I scroll down, Clusterize creates the "top-space" row which is an empty tr. So my browser cannot set the fixed width (the width comes from the first displayed row).

Here is the example : http://jsfiddle.net/kx9fa0se/9/

NeXTs commented 9 years ago

Hi Good catch! Thanks for repothing this issue. I will investigate

NeXTs commented 9 years ago

as a quick workaround duplicate empty thead columns into table http://jsfiddle.net/kx9fa0se/10/

jbanety commented 9 years ago

I didn't think about it. I added several td to the "top-space" tr when "clusterChanged" event triggers. Your workaround is better.

NeXTs commented 9 years ago

I added several td to the "top-space" tr when "clusterChanged" event triggers.

:D brutal

jbanety commented 9 years ago

Yes It's a bit hacky but It does it !

jbanety commented 9 years ago

This workaround breaks the "no data" row which needs a colspan to be as larger as the entire table.

NeXTs commented 9 years ago

@jbanety sad to hear that Since you've already forked project, add temporarily extra line here

td = document.createElement('td');
td.colSpan = 100;

This will force td to be full width. I'll think about better solution

vamp commented 8 years ago

@NeXTs, better would be to add some callback, e.g. generateEmptyRow and pass created element to it:

var callbacks = options.callbacks;
callbacks.generateEmptyRow && callbacks.generateEmptyRow(empty_row);
NeXTs commented 8 years ago

I'm planning to rethink clusterize structure and instead of additional tags, use paddings/margins