New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Responsive tables #29

Closed
martinpesout opened this Issue Jun 30, 2015 · 6 comments

Comments

Projects
None yet
3 participants
@martinpesout

Hi, how can I re-init whole table after resizing of the window. Scrolling seems to be broken after resizing whole table because height of the cells is different.

Thanks

@NeXTs

This comment has been minimized.

Show comment
Hide comment
@NeXTs

NeXTs Jun 30, 2015

Owner

Hi Martin!
That's a good question, clusterize was designed for static height rows.
I like your idea so I'll implement it into plugin as soon as I'm released.
As a quick workaround you could do something like this.

var clusterize;
function initClusterize() {
  clusterize = new Clusterize({
    rows: data,
    scrollId: 'scrollArea',
    contentId: 'contentArea'
  });
}

var resize_debouncer = 0;
$(window).on('resize', function() {
  clearTimeout(resize_debouncer);
  resize_debouncer = setTimeout(function() {
    clusterize && clusterize.destroy(true);
    initClusterize();
  }, 100);
});
initClusterize();

This will force clusterize to adapt to new rows height.
If you render rows by yourself (array of strings) - everything must work quickly.
Important note: clusterize.destroy(true) - parameter should be true, otherwise all rows would be inserted into table and of course that may be slow

Owner

NeXTs commented Jun 30, 2015

Hi Martin!
That's a good question, clusterize was designed for static height rows.
I like your idea so I'll implement it into plugin as soon as I'm released.
As a quick workaround you could do something like this.

var clusterize;
function initClusterize() {
  clusterize = new Clusterize({
    rows: data,
    scrollId: 'scrollArea',
    contentId: 'contentArea'
  });
}

var resize_debouncer = 0;
$(window).on('resize', function() {
  clearTimeout(resize_debouncer);
  resize_debouncer = setTimeout(function() {
    clusterize && clusterize.destroy(true);
    initClusterize();
  }, 100);
});
initClusterize();

This will force clusterize to adapt to new rows height.
If you render rows by yourself (array of strings) - everything must work quickly.
Important note: clusterize.destroy(true) - parameter should be true, otherwise all rows would be inserted into table and of course that may be slow

@martinpesout

This comment has been minimized.

Show comment
Hide comment
@martinpesout

martinpesout Jul 1, 2015

Cool, it works. Thanks

Cool, it works. Thanks

@NeXTs NeXTs closed this in 2c93792 Jul 1, 2015

@NeXTs

This comment has been minimized.

Show comment
Hide comment
@NeXTs

NeXTs Jul 1, 2015

Owner

@s-a @martinpesout

Hello guys, please update to last version of clusterize and check how it works for you after window resize. You need to remove workaround that I gave you earlier, default init should be enough now.

var clusterize = new Clusterize({
  rows: data,
  scrollId: 'scrollArea',
  contentId: 'contentArea'
});
Owner

NeXTs commented Jul 1, 2015

@s-a @martinpesout

Hello guys, please update to last version of clusterize and check how it works for you after window resize. You need to remove workaround that I gave you earlier, default init should be enough now.

var clusterize = new Clusterize({
  rows: data,
  scrollId: 'scrollArea',
  contentId: 'contentArea'
});
@martinpesout

This comment has been minimized.

Show comment
Hide comment
@martinpesout

martinpesout Jul 2, 2015

Thanks. It works like a charm :)

Thanks. It works like a charm :)

@s-a

This comment has been minimized.

Show comment
Hide comment
@s-a

s-a Jul 2, 2015

👍 👍

s-a commented Jul 2, 2015

👍 👍

@NeXTs

This comment has been minimized.

Show comment
Hide comment
@NeXTs

NeXTs Jul 3, 2015

Owner

@s-a @martinpesout
Fixed an old bug, got new one :D
You need to upgrade to v0.8.2

Owner

NeXTs commented Jul 3, 2015

@s-a @martinpesout
Fixed an old bug, got new one :D
You need to upgrade to v0.8.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment