Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SlickGrid with first column fixed

Is it possible to make the first column of a SlickGrid fixed? So that it is always visible during horizontal scrolling, like the header-row?

Thanks for help!

like image 201
user1027167 Avatar asked Nov 16 '11 12:11

user1027167


2 Answers

There was another forum link (can't find it now) that lead my to JLynch's fork. He maintains both a 1.4.3 tag with his patches for frozen columns and rows, as well as maintaining a 2.0 head. Here is the 2.0 example with both frozen rows and columns.

In that example, the author uses a couple additional options properties:

        ,topPanelHeight: 25
        ,frozenColumn: 2
        ,frozenRow: 5

Hopefully this does what you want without having to hack too much on the core!

like image 172
bollwyvl Avatar answered Sep 18 '22 14:09

bollwyvl


I think you can make in the event .onViewportChanged() the next steps:

  1. Get the columns with .getColumns() and stored in an array variable arrColumns.
  2. Then detect the first column.
  3. Store the data with .getData() in an array variable arrData
  4. Sort arrColumns putting the first column at the beginning.
  5. Set the columns in the new arrColumns with .setColumns()
  6. Reassembly arrData with the order of the new arrColumns.
  7. Call .resizeCanvas()
  8. Cross your fingers. :D

Sorry but I don't find a method or an option in that you can make this behavior in the way that you want.

Well, see what you think of this. It is far from perfect, but it is an idea. I would make something better if the method scrollTo() would be public.

like image 29
Galled Avatar answered Sep 19 '22 14:09

Galled