Nov 02, 2011, 3:12 PM
Gridpanel Column width based on column content?
Hello,
I have a very simple grid panel that shows a ticket's comments. The comments are variable lengths.
I don't want to set a column width to encompass the max comment size as its ugly in instances where the comments are very brief/terse.
I'd prefer if possible the ability to horizontally scroll ONLY when the comments column is larger than what fits in the gridpanel.
Here is my code and a screenshot of what I mean.
I have a very simple grid panel that shows a ticket's comments. The comments are variable lengths.
I don't want to set a column width to encompass the max comment size as its ugly in instances where the comments are very brief/terse.
I'd prefer if possible the ability to horizontally scroll ONLY when the comments column is larger than what fits in the gridpanel.
Here is my code and a screenshot of what I mean.
<ext:Panel ID="pnComments" runat="server" Width="550" Height="200" Title="Comments"
Layout="Fit" Icon="Table">
<Items>
<ext:GridPanel ID="gpComments" runat="server" Border="false" BodyStyle="background-color:transparent"
AutoExpandColumn="Comments">
<Store>
<ext:Store ID="sComments" runat="server">
<Reader>
<ext:JsonReader>
<Fields>
<ext:RecordField Name="TimeStamp" Type="Date" />
<ext:RecordField Name="NTLogin" />
<ext:RecordField Name="Text" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
</Store>
<ColumnModel>
<Columns>
<ext:DateColumn DataIndex="TimeStamp" Format="MM-dd-yy HH:mm:ss tt" Header="Submitted On"
Width="120" />
<ext:Column DataIndex="NTLogin" Header="Submitted By" Width="120" />
<ext:Column ColumnID="Comments" DataIndex="Text" Header="Comment" Width="400" />
</Columns>
</ColumnModel>
</ext:GridPanel>
</Items>
</ext:Panel>