This is a migrated thread and some comments may be shown as answers.

[Solved] How to resize grid columns clientside using javascript?

0 Answers 12 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Andy
Top achievements
Rank 1
Andy asked on 12 Dec 2012, 09:10 PM
I'm scratching my head over this.

I am keeping track of column sizes client-side (stored in localStorage) as and when the users resize the grid columns (using the onGridColumnResize event).

What I want to then do is reapply the column sizes the next time the grid is rendered. I don't want to set the column widths server-side as part of the binding. Don't ask me why, it's just the way the system is designed. We don't track user column width preferences server-side.

The grid is configured to be scrollable so that the columns can be user-resized (if it's not setup as scrollable this doesn't work for some reason - not sure if this is a bug in the grid).

I've tried setting widths on the following using jQuery with no luck. I seem to only be able to set the div.t-grid width and then auto-magically all the columns take up space so that they fit the width of their container:
div.t-grid col

I've looked through the grid resize javascript and it's doing all sorts of things with drag events but none of it is public - there is no public api to abstract all the manipulations going on.

Has anyone successfully managed to programatically, in javascript been able to set individual column widths using a pixel value AND have the grid auto-size to fit?

Thanks.
Tags
Grid
Asked by
Andy
Top achievements
Rank 1
Share this question
or