-
22 Oct 2011 6:04 AM #1
Answered: setting columnWidth and column header dynamically
Answered: setting columnWidth and column header dynamically
hi every body,
in extjs3 we used the following functions to set proprieties:
but how to do it in extjs4 ?????????Code:var colMod = grid.getColumnModel(); colMod.setColumnHeader(1, 'new header'); colMod.setColumnWidth(1, 144);

thanks
-
Best Answer Posted by twaindev
What version do you use? In 4.0.7. it works just fine.
-
22 Oct 2011 1:53 PM #2
Here's one way:
Code:var col = grid.headerCt.getHeaderAtIndex(1); col.setText('new header'); col.setWidth(144);
-
23 Oct 2011 12:01 AM #3
thanks for reply,
the following code is working fine
but the statement:Code:var col = grid.headerCt.getHeaderAtIndex(2); col.setText('new header');
sets the new width of the column only if the new width is grater than the old width,Code:col.setWidth(144);
but if the new width is smaller than the old width , no change in column width why??
-
23 Oct 2011 1:47 AM #4
Does the column have a flex config?
If it does you'll have to set it to 0 (zero) otherwise the width of the column can only be greater than the calculated width.
Code:var col = grid.headerCt.getHeaderAtIndex(1); col.setText('new header'); col.flex = 0; col.setWidth(50);
-
25 Oct 2011 12:09 AM #5
sorry twaindev, I still have the same problem,
my column configuration is:
Code:{ header : 'Name', width:120, dataIndex : 'name', }Code:var col = grid.headerCt.getHeaderAtIndex(1); col.setText('new header'); //works fine col.flex = 0; col.setWidth(50); // no result , can't be less than the old width(120)
-
25 Oct 2011 1:10 AM #6
What version do you use? In 4.0.7. it works just fine.
-
26 Oct 2011 3:24 AM #7
i'm using extjs4.0.7 now ,and evey thing works fine.
thank you very much twaindev.
but i want to ask you , if you have any idea about version 4.1, when to release it?
is it contain a pivot grid like version 3.2.1?
is it contain an rtl ?
-
26 Oct 2011 3:50 AM #8
I don't know about the release date.
You can read about the preview here:
http://www.sencha.com/blog/ext-js-4-...loper-preview/
Please select the answer that helped you most to close this topic.


Reply With Quote