[CLOSED] How to wrap text in auto expand column in gridpanel?

  1. #1

    [CLOSED] How to wrap text in auto expand column in gridpanel?

    Hi,

    I want to wrap text in the cell at auto expand column in grid panel. According to solution at
    http://www.sencha.com/learn/grid-faq...grid_column.3F
    I can implement for fixed width column, in my case the grid panel shows only Id and comments for that Id, so auto expand column is comments column. I can't make the comments column as fixed width column. The css I have implemented as below

    
    td.x-grid3-td-IdCmt 
            {
                overflow: hidden;
            }
            td.x-grid3-td-IdCmt div.x-grid3-cell-inner 
            {
                font-family: "segoe ui" ,tahoma, arial, sans-serif;
                white-space: normal;
            }
    Last edited by Daniil; Apr 16, 2012 at 11:46 AM. Reason: [CLOSED]
  2. #2
    Hi,

    Could you provide a sample which would demonstrate the requirement?
  3. #3
    Hi Daniil,

    Here is the sample code. I want "Comment" column as autoexpand column. If I add it the wrap is not working. Please check it.


    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="ExtWrapTextExample.aspx.vb"
        Inherits="Testing_ExtWrapTextExample" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <style  type="text/css">
        td.x-grid3-td-IdCmt 
        {
            overflow: hidden;
        }
        td.x-grid3-td-IdCmt div.x-grid3-cell-inner 
        {
            font-family: "segoe ui" ,tahoma, arial, sans-serif;
            white-space: normal;
        }
        </style>
    </head>
    <body>
        <form id="form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        <ext:Store ID="LoanCommentsStore" runat="server">
            <Reader>
                <ext:JsonReader IDProperty="ROW_ID">
                    <Fields>
                        <ext:RecordField Name="ROW_ID" />
                        <ext:RecordField Name="COMMENT" Type="String" />
                    </Fields>
                </ext:JsonReader>
            </Reader>
        </ext:Store>
        <ext:GridPanel ID="gvCommentReg" runat="server" StoreID="LoanCommentsStore" AnchorHorizontal="100%"
            Region="Center" Title="Search Results" MaskDisabled="false" Height="400">
            <ColumnModel ID="ColumnModel5" runat="server">
                <Columns>
                    <ext:Column Header="Comment ID" DataIndex="ROW_ID" />
                    <ext:Column Header="Comment" DataIndex="COMMENT" ColumnID="IdCmt" width="450" Wrap="true"/>
                </Columns>
            </ColumnModel>        
        </ext:GridPanel>
        </form>
    </body>
    </html>
    code behind...
    
    
    Partial Class Testing_ExtWrapTextExample
        Inherits System.Web.UI.Page
    
        Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
            If Not Ext.Net.X.IsAjaxRequest Then
                Call LoadComments()
            End If
        End Sub
    
        Public Sub LoadComments()
            LoanCommentsStore.DataSource = GetComments()
            LoanCommentsStore.DataBind()
        End Sub
    
        Public Function GetComments() As DataTable
            Dim dt As New DataTable
            Dim dr As DataRow
            Dim i As Integer = 0
            Dim strTempText As String = "This text used to check wrap in grid panel cell. This text used to check wrap in grid panel cell. This text used to check wrap in grid panel cell. This text used to check wrap in grid panel cell. This text used to check wrap in grid panel cell. This text used to check wrap in grid panel cell. This text used to check wrap in grid panel cell."
            dt.Columns.Add("ROW_ID")
            dt.Columns.Add("COMMENT")
    
            For i = 0 To 25
                dr = dt.NewRow()
                dr(0) = i
                dr(1) = strTempText
                dt.Rows.Add(dr)
            Next
            Return dt
        End Function
    End Class
    Quote Originally Posted by Daniil View Post
    Hi,

    Could you provide a sample which would demonstrate the requirement?
  4. #4
    You should set up
    AutoExpandColumn="IdCmt"
    for the GridPanel.

    You might also need to increase its AutoExpandMax (default to 1000). Foe example,
    AutoExpandMax="5000"

Similar Threads

  1. [CLOSED] gridpanel column wrap is not working
    By majestic in forum 1.x Premium Help
    Replies: 2
    Last Post: Apr 26, 2011, 2:58 PM
  2. Replies: 4
    Last Post: Dec 13, 2010, 12:48 PM
  3. Help Needed with auto expand column
    By pooja in forum 1.x Help
    Replies: 2
    Last Post: Nov 25, 2010, 8:26 AM
  4. wrap Text in GridPanel
    By sachin.munot in forum 1.x Help
    Replies: 2
    Last Post: Nov 07, 2009, 12:13 AM
  5. [CLOSED] GridPanel Column Wrap
    By Timothy in forum 1.x Premium Help
    Replies: 1
    Last Post: Jun 03, 2009, 6:15 PM

Tags for this Thread

Posting Permissions