I have a simple ExtJS grid with 5 columns in it. I need the columns to resize to based on header text size on first load. i.e., all the column headers should be visible.
我有一个简单的ExtJS网格,里面有5列。我需要在第一次加载时根据标题文本大小调整列的大小。即,所有列标题都应该是可见的。
I already tried
我已经试过了
grid.columns[3].autoSize();
grid.columns[4].autoSize();
but it resizes according to column content width and not the header text itself. Also, fixed widths and flex are not an option.
但它根据列内容宽度调整大小,而不是标题文本本身。此外,固定宽度和弯曲不是一种选择。
The problem is, that the header text is dynamic and it's important that header text is entirely visible each time the grid is loaded and at the same time, the width of column should not exceed header text size.
问题是,标题文本是动态的,每次加载网格时标题文本完全可见是很重要的,同时列的宽度不应超过标题文本大小。
1 个解决方案
#1
0
Try this code its work for me by providing flex property.
通过提供flex属性,尝试使用此代码为我工作。
columns : [{header : 'Name',dataIndex : 'name', flex : 1},{header : 'First Name',dataIndex : 'firstName', flex : 1}]
#1
0
Try this code its work for me by providing flex property.
通过提供flex属性,尝试使用此代码为我工作。
columns : [{header : 'Name',dataIndex : 'name', flex : 1},{header : 'First Name',dataIndex : 'firstName', flex : 1}]