Login Register

help with setCellWidth

I am trying to add a custom functionality to the grid that would allow it to try and autoWidth according to the content. Currently my problem has been finding a method that would change the width of the whole column. gridObject.setCellWidth() only changes the view and I can not seem to find a way to make the content resize too.
Any help is extremely welcome.

I think you're looking for

I think you're looking for the setColWidth method on each view object. To resize the second column in your first view to 200 pixels, call

grid.views.views[0].setColWidth(1, 200);
grid.views.views[0].update();

No, thats not it. The source

No, thats not it. The source code for setColWidth shows that its just an alias for the gridObject.setCellWidth method. I have been calling render to show my resizing, maybe update would do the trick? ill check the source.

Thanks for the reply and the new hint (the update method) to go on :) In the meantime I have moved on to resizing the columns myself through css. Ill check this out when I have time to refactor :)

I ran that code myself

I ran that code myself before I posted it. It works :).

hummm

Doesn't for me. Maybe due to having width set to auto on the cells. When I do a setCellWidth only the header is changed. The content is left untouched. In the meantime I have moved on but maybe when I refactor the code I can manage to get this working.

Maybe this helps

>I think you're looking for the setColWidth method on each view object. To resize the second column in your first view to 200 pixels, call
> grid.views.views[0].setColWidth(1, 200);
> grid.views.views[0].update();

Maybe an additional
grid.views.views[1].update();

does the trick. Because views[0] is probably only for the headers, and view[1] for the rest.

(P.S.: this is my first post, and there is no preview, and "format as" is an empty box. Sorry if it looks ugly)