user1027167
user1027167

Reputation: 4438

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!

Upvotes: 5

Views: 10083

Answers (3)

bollwyvl
bollwyvl

Reputation: 1241

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!

Upvotes: 12

Galled
Galled

Reputation: 4206

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.

Upvotes: 5

deprecated
deprecated

Reputation: 5242

I know this doesn't fully match your needs, but you can completely avoid horizontal scrolling by setting forceFitColumns to true in the options object.

I reckon that this behavior would be undesirable for users with a very small screen.

Upvotes: 0

Related Questions