substanced icon indicating copy to clipboard operation
substanced copied to clipboard

Misaligned SlickGrid Columns

Open ghost opened this issue 11 years ago • 10 comments

I've added several columns to my SDI display. When rendered, the columns and their headers are out of alignment:

skewed_grid

If, I slightly resize the window, the alignment is corrected:

fixed

I'm using Chromium Version 30.0.1599.114 (229842).

This is only a minor bug. I'm guessing its some nuance with SlickGrid?

ghost avatar Dec 08 '13 13:12 ghost

I gave a try with this on Chrome on OS X. Couldn't reproduce. I downloaded Chromium (for OSX, today's build) and couldn't reproduce. Here is a screencast of me resizing stuff:

http://www.screencast.com/t/Eer7wvC1hfis

If you can provide a public URL I can either test against or pull locally and attest against, I can give it a try.

pauleveritt avatar Feb 09 '14 21:02 pauleveritt

Hi Paul,

Thanks for looking into it. I'm still seeing this problem. I just took this screenshot from the substanced demo site (http://demo.substanced.net/manage/binder_0/@@contents) image

The 'creator' column is misaligned with the column header. The effect is more pronounced when more columns are involved. When I resize the window, the columns align correctly. I checked and I'm also seeing this problem on win 7 & firefox (plus linux and chromium from my original post).

I'm guessing it might be related to this SO entry http://stackoverflow.com/questions/8559487/slick-grid-header-row-cell-alignment

ghost avatar Feb 09 '14 23:02 ghost

I can confirm the bug on 32.0.1700.19 (235778) (Linux)

domenkozar avatar Feb 10 '14 08:02 domenkozar

Looks like I'll need to get access to Chromium/Linux.

--Paul

On Feb 10, 2014, at 3:37 AM, Domen Kožar [email protected] wrote:

I can confirm the bug on 32.0.1700.19 (235778) (Linux)

— Reply to this email directly or view it on GitHub.

pauleveritt avatar Feb 10 '14 14:02 pauleveritt

I poked around some more, and I found a couple of solutions from https://github.com/mleibman/SlickGrid/issues/742

I tried both of these and they do work for me.

  1. add the following to sdi_bootstrap.css or .less:
#sdi-contents-table-sg, #sdi-contents-table-sg div {
  -webkit-box-sizing: content-box;
     -moz-box-sizing: content-box;
          box-sizing: content-box;
}
  1. call grid.autosizeColumns(); when the page loads. I did this through firebug/developer tools with:
var grid = $('#sdi-contents-table-sg').data('slickgrid').grid;
grid.autosizeColumns();

But I imagine that could be worked in with the slickgrid initialization, somewhere.

I'm afraid this is far enough outside my comfort zone I don't know the merits of either approach. Hopefully someone with a better understanding of bootstrap and slickgrid can weigh in?

ghost avatar Feb 10 '14 15:02 ghost

I think UI should be done CSS first and JS if you have no other choices. If you include BS mixins in your less file you can use .box-sizing('content-box') in your selector:

#sdi-contents-table-sg, #sdi-contents-table-sg div {
  .box-sizing('content-box');
}

blaflamme avatar Feb 10 '14 15:02 blaflamme

I did what I thought would work here (adding the less that blaflamme suggests above, regenerating the css, adding grid.autosizeColumns() in various places in the JS and template) but I can't seem to get it to do the autosizing at first render time. If I subsequently go to the console and do what @cahman did, it indeed does size the columns, so I'm sure it's just a matter of putting the call to autosizeColumns in the "right" place, wherever that is.

mcdonc avatar May 17 '14 19:05 mcdonc

See https://github.com/Pylons/substanced/commit/851be80268f3c8f1c27fb6894c448678693d54b2 for my attempted fix, if anyone can help diagnose.

mcdonc avatar May 17 '14 19:05 mcdonc

I can find the right place. @mcdonc, could you reproduce it and on which browser?

reebalazs avatar May 18 '14 09:05 reebalazs

@reebalazs yeah i can reproduce it .. first load of http://demo.substanced.net/manage/ordered_binder/@@contents ("Creator" header is too far left, resize window and it snaps back to the right position) in Chromium / Linux.

mcdonc avatar May 18 '14 18:05 mcdonc