header column, (aka frozen columns?)

1,425 views
Skip to first unread message

Jonathan Hartley

unread,
Jul 1, 2010, 2:30:47 PM7/1/10
to SlickGrid
Hey. Me again! Thanks for helping a total newb.

I'm trying to create a grid that's 'spreadsheet-like'.

In particular, I'd like the leftmost column to be a 'header column',
much like the existing 'header row'. I only just realised that I don't
know how to do this. Am I overlooking something, or is this not
explicitly supported?

I have set the leftmost column to be
{resizeable:false, unselectable:true, behaviour:"select",}
and the cssStyle to look like the header row. That's pretty good. But
of course horizontal scrolling scrolls the column off screen, which
isn't what I want.

I notice 'frozen columns' mentioned under TODO in slick.grid.js. Does
this mean what I want, or am I misinterpreting?

Best regards,

Jonathan

Michael Leibman

unread,
Jul 1, 2010, 3:03:56 PM7/1/10
to slic...@googlegroups.com
Yes, what you need there is "frozen columns" like in Excel.
Unfortunately, that's a big one to implement.  It's on the list, but I cannot give you an ETA.

Jonathan Hartley

unread,
Jul 2, 2010, 11:07:44 AM7/2/10
to SlickGrid
Fair enough. Thanks for the reply.

Even without this, I *still* prefer SlickGrid over the others I've
been evaluating, even the commercial ones. So for the moment I'm
thinking of hacking this together using two adjacent grids, the left
one being the header col with no scrollbars on it, and forwarding
scroll events from right grid to it.

I'll report back if I have any success. Best regards.


On Jul 1, 8:03 pm, Michael Leibman <michael.leib...@gmail.com> wrote:
> Yes, what you need there is "frozen columns" like in Excel.
> Unfortunately, that's a big one to implement.  It's on the list, but I
> cannot give you an ETA.
>

Jonathan Hartley

unread,
Jul 2, 2010, 11:55:21 AM7/2/10
to SlickGrid
Incidentally: I don't know Javascript, so it might take me quite some
time. :-)

Jonathan Hartley

unread,
Jul 5, 2010, 6:23:58 AM7/5/10
to SlickGrid
For the record, I didn't have much luck with this, no doubt due to my
own ignorance.

I created two grids, the leftmost grid just has a single column,
styled to look the same as the header row. The rightmost grid just
contains its header row and then a bunch of empty rows.

Disabling the vertical scrollbar of the leftmost grid I achieved by
setting its overflow-y to "hidden". So it already looks like Excel. So
far, so good.

When it comes to scrolling, though, I was unable to get it to behave.
I passed the leftmost grid into the rightmost grid as a new option. I
had hoped that I could add some code to 'handleScroll' or something,
that would set the leftmostGrid.currentScrollTop to be the same as the
rightmostGrid currentScrollTop, and everything would just magically
work.

Sadly, it didn't seem to have any effect - the leftmost grid never
moved.

I don't really know what I'm doing. With hindsight, this whole
approach probably wasn't such a good idea. Time for me to go hit the
javascript and DOM books. Wish me luck.

Jonathan

Michael Leibman

unread,
Jul 5, 2010, 5:44:14 PM7/5/10
to slic...@googlegroups.com
Sorry it didn't work, but don't sweat it.  Synchronizing the scroll position is doable, but it's a complete hack and there are too many drawbacks for it to be useful anyway :)

I have been giving a lot of though to actually implementing support for frozen columns though.  
I played around with several ways of implementing this, and I think I've found a good compromise.  My fear was that it would be impossible to implement frozen columns without impacting the performance dramatically, but I was able to get the overhead down to at most 20%, and that I can live with.  I also have recently made a lot of changes to make the implementation easier.

It is still a ton of work though, and I want to stabilize and ship 1.4 before tackling this, so don't expect it to arrive anytime soon.  But it is coming.

Jonathan Hartley

unread,
Jul 6, 2010, 4:27:02 AM7/6/10
to slic...@googlegroups.com
Many thanks for the info, it's good to hear your thoughts on the matter.

We've decided to work towards v0.1 of our product on the assumption it'll ship without a frozen header column, and that will get fixed (by you or by us) as and when. Me and my coworkers would offer to help in some way, but we're all Javascript newbs, so for the moment there's not much we can do. We'll do bug reports when the time comes around, I promise! :-)

    Jonathan
-- 
Jonathan Hartley      Made of meat.      http://tartley.com
tar...@tartley.com   +44 7737 062 225   twitter/skype: tartley

Rasoul

unread,
Sep 18, 2012, 12:40:06 PM9/18/12
to slic...@googlegroups.com
Hello,

I was just collecting some information on different grids and comparing the different features that each and every grid supports to decide which one fits our needs. The one thing that I was looking for was the frozen column feature. I couldn't find any example on GitHub or anything in documentation to indicate if this feature has been implemented yet. I appreciate any feedback on this.

Regards,
Rasoul

Dmitry Chornyi

unread,
Oct 11, 2012, 9:15:46 PM10/11/12
to slic...@googlegroups.com

Gianluca Bisceglie

unread,
Oct 12, 2012, 4:58:19 AM10/12/12
to slic...@googlegroups.com
I understand Michael did not want to merge this branch. Is it because it may have a serious impact on the behavior of the grid: having frozen columns would be great but breaking the grid would be not.

Does anyone know more about this?

Thanks,
Gian
Reply all
Reply to author
Forward
0 new messages