[CLOSED] GridPanel Widths

  1. #1

    [CLOSED] GridPanel Widths

    Hello,

    If you look at the below simplified example you will notice that the widths on the Columns are not listening to their set values, especially on the last column where I have set the width to be 100, it renders as half the GridPanel:

    Example.aspx:
    <%@ Page Language="C#" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <script runat="server">
    
        protected void Projects_RefreshData(object sender, StoreRefreshDataEventArgs e)
        {
            Projects.DataSource = new object[] {
                new object[] { 1, "Group 1", "Project 1", "Lorem ipsum", 1 },
                new object[] { 2, "Group 1", "Project 2", "Lorem ipsum", 2 },
                new object[] { 3, "Group 2", "Project 3", "Lorem ipsum", 0 },
                new object[] { 4, "Group 2", "Project 4", "Lorem ipsum", 0 }
            };
            Projects.DataBind();
        }
        
    </script>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Example</title>
    </head>
    <body>
        <form id="form1" runat="server">
            <asp:ScriptManager runat="server" EnablePartialRendering="true" />
            <ext:ScriptManager runat="server" />
            <ext:Store ID="Projects"
                runat="server"
                AutoLoad="true"
                GroupField="Grouping"
                IgnoreExtraFields="true"
                OnRefreshData="Projects_RefreshData">
                <Proxy>
                    <ext:DataSourceProxy />
                </Proxy>
                <Reader>
                    <ext:ArrayReader ReaderID="ProjectId">
                        <Fields>
                            <ext:RecordField Name="ProjectId" Type="Auto" />
                            <ext:RecordField Name="Grouping" />
                            <ext:RecordField Name="DisplayName" />
                            <ext:RecordField Name="Description" />
                            <ext:RecordField Name="Submissions" />
                        </Fields>
                    </ext:ArrayReader>
                </Reader>
                <SortInfo Field="DisplayName" />
            </ext:Store>
            <ext:Panel runat="server">
                <Body>
                    <ext:FitLayout runat="server">
                        <ext:GridPanel ID="dgProjects"
                            runat="server"
                            StoreID="Projects"
                            AutoExpandColumn="DisplayName"
                            AutoHeight="true"
                            AutoWidth="true"
                            Border="false">
                            <ColumnModel>
                                <Columns>
                                    <ext:Column ColumnID="Grouping" DataIndex="Grouping" />
                                    <ext:Column ColumnID="DisplayName" DataIndex="DisplayName" Header="Project" />
                                    <ext:CommandColumn ColumnID="Public" Width="100">
                                        <Commands>
                                            <ext:CommandFill />
                                            <ext:GridCommand CommandName="Submit" StandOut="true" Text="Submit" />
                                        </Commands>
                                    </ext:CommandColumn>
                                </Columns>
                            </ColumnModel>
                            <View>
                                <ext:GroupingView runat="server"
                                    ForceFit="true"
                                    EnableGroupingMenu="false"
                                    EnableRowBody="true"
                                    HideGroupedColumn="true"
                                    ShowGroupName="false">
                                    <GetRowClass Handler="rowParams.body = record.data.Description ? '<div style=\'padding: 5px 10px;\'>' + record.data.Description + '
    ' : '';" />
                                </ext:GroupingView>
                            </View>
                        </ext:GridPanel>
                    </ext:FitLayout>
                </Body>
            </ext:Panel>
        </form>
    </body>
    </html>
    Cheers,
    Timothy
  2. #2

    RE: [CLOSED] GridPanel Widths

    I've updated my original source code, simplified it further. If you remove the GroupingView it works as expected.

    Used the following broswers: IE6, FF3.0

    Cheers,
    Timothy
  3. #3

    RE: [CLOSED] GridPanel Widths

    Hi Timothy,

    You set ForceFit="true" for GroupingView. It is a reason why column was resized


    forceFit : Boolean
    True to auto expand/contract the size of the columns to fit the grid width and prevent horizontal scrolling.



    Remove ForceFit or set Fixed="true" for non-resizable columns


    fixed : Boolean
    (optional) True if the column width cannot be changed. Defaults to false.





  4. #4

    RE: [CLOSED] GridPanel Widths

    Vladsch, thanks. Removing the ForceFit appears to have corrected the problem. However, there is no option for the Fixed property?

    Cheers,
    Timothy
  5. #5

    RE: [CLOSED] GridPanel Widths

    You can set Fixed="true" on the Column.

    Example


    <ext:CommandColumn ColumnID="Public" Width="100" Fixed="true">

    Hope this helps.


    Geoffrey McGill
    Founder
  6. #6

    RE: [CLOSED] GridPanel Widths

    Oops, doh, thanks both of you ;)

    Cheers,
    Timothy

Similar Threads

  1. [CLOSED] Gridpanel : set different widths per rows for the same column
    By tlfdesarrollo in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Jan 13, 2012, 6:46 AM
  2. Replies: 1
    Last Post: Jan 07, 2012, 10:02 AM
  3. [CLOSED] Dynamic GridPanel: Column widths are always the same size
    By deejayns in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 22, 2011, 3:37 PM
  4. Replies: 3
    Last Post: Apr 06, 2011, 6:27 PM
  5. [CLOSED] [1.0] BorderLayout percentage widths
    By danielg in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jan 19, 2011, 2:22 PM

Posting Permissions