[CLOSED] CellEditing does not place the editor correctly in the grid

  1. #1

    [CLOSED] CellEditing does not place the editor correctly in the grid

    Run this example and click on a cell in the Amount column.
    Grid shifts to the right, the editor launches in the place where the cell used to be and the editor width is not obeyed.

    Ext 2.5.3.1
    .NET 4.5
    ID 9, 10 or Edge

    <%@ Page Language="C#" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                stDonations.DataSource = new List<object>
                {
                    new { Id = 1, Name = "Oxfam", Amount = 10D },
                    new { Id = 2, Name = "Save the Children", Amount = 50D },
                    new { Id = 3,Name = "Local Hospital", Amount = 20D }
                };
                stDonations.DataBind();
            }
        }
    </script>
        
    <!DOCTYPE html>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <ext:ResourceManager ID="ResourceManager1" runat="server">
        </ext:ResourceManager>
    
    <ext:Window ID="myWindow"
        runat="server"
        Modal="True"
        Maximizable="True"
        Icon="MoneyDollar"
        Title="Renew Permit"
        Width="800"
        Height="470"
        Layout="Fit">
        <Items>
            <ext:FormPanel
                ID="DonationForm"
                runat="server"
                AutoScroll="true"
                BodyPaddingSummary="15 5 5 5">
                <FieldDefaults LabelAlign="Left" LabelSeparator="" LabelWidth="150" HideEmptyLabel="False" />
                <Items>
                    <ext:FieldContainer runat="server" ID="FieldContainer1"
                        MarginSpec="10 0 0 0">
                        <Items>
                            <ext:GridPanel
                                ID="gpDonations"
                                runat="server"
                                Width="400"
                                Layout="FitLayout"
                                AutoScroll="True"
                                EnableColumnHide="False"
                                MinHeight="120">
                                <Store>
                                    <ext:Store ID="stDonations" runat="server">
                                        <Model>
                                            <ext:Model runat="server" IDProperty="Id">
                                                <Fields>
                                                    <ext:ModelField Name="Id" Type="Int" />
                                                    <ext:ModelField Name="Name" Type="String" />
                                                    <ext:ModelField Name="Amount" Type="Float" />
                                                </Fields>
                                            </ext:Model>
                                        </Model>
                                    </ext:Store>
                                </Store>
                                <ColumnModel runat="server">
                                    <Columns>
                                        <ext:Column
                                            runat="server"
                                            Text="Description"
                                            DataIndex="Name"
                                            Flex="1"
                                            Wrap="true" />
                                        <ext:NumberColumn runat="server"
                                            Text="Amount"
                                            Width="100"
                                            DataIndex="Amount"
                                            Format="#,##0.00"
                                            Align="Right">
                                            <Editor>
                                                <ext:TextField runat="server"
                                                    AllowBlank="False"
                                                    Width="100"/>
                                            </Editor>
                                        </ext:NumberColumn>
                                    </Columns>
                                </ColumnModel>
                                <Plugins>
                                    <ext:CellEditing runat="server" ClicksToEdit="1" />
                                </Plugins>
                            </ext:GridPanel>
                        </Items>
                    </ext:FieldContainer>
                </Items>
            </ext:FormPanel>
        </Items>
    </ext:Window>
    </body>
    </html>
    Last edited by Daniil; Jul 23, 2015 at 8:25 AM. Reason: [CLOSED]
  2. #2
    Hi @PeterParsonage,

    A FormPanel's FieldDefaults setting are being applied to a TextField Edtior. I understand why it happens, but, personally, I would except it doesn't happen. Though, a layout is sort of controversial. A GridPanel is not a field and, ideally, it should not be inside a FormPanel.

    Anyways, there is an easy workaround.
    <ext:TextField ...>
        <CustomConfig>
            <ext:ConfigItem Name="hideEmptyLabel" Value="true" Mode="Raw" />
        </CustomConfig>
    </ext:TextField>
  3. #3
    Brilliant!
    Thank you.

    I am wondering why CustomConfig works with hideEmptyLabel but the attribute HideEmptyLabel="true" does not. However, HideLabel attribute does.

    I ended up with just adding HideLabel="True" to the TextField and it works like a charm.
    Last edited by Daniil; Jul 23, 2015 at 8:21 AM. Reason: Used [VAR] tags
  4. #4
    I am wondering why CustomConfig works with hideEmptyLabel but the attribute HideEmptyLabel="true" does not. However, HideLabel attribute does.
    Well, in brief it is true by default and it is not rendered to client. It doesn't check a FieldDefaults of upper containers. Implementing such a check would be challenging. Therefore, a solution would be to always render a value to client if it is explicitly set. Maybe, we will revisit it for the next major Ext.NET release.

Similar Threads

  1. Replies: 4
    Last Post: Aug 25, 2015, 4:35 PM
  2. Replies: 6
    Last Post: Mar 24, 2014, 8:03 AM
  3. Replies: 20
    Last Post: Jul 29, 2013, 12:11 PM
  4. [CLOSED] Place focus in first row of grid
    By Pablo_Azevedo in forum 1.x Premium Help
    Replies: 8
    Last Post: Mar 23, 2012, 5:09 PM
  5. how to place Search For grid panel
    By Dinesh.T in forum 1.x Help
    Replies: 0
    Last Post: May 24, 2010, 11:16 AM

Tags for this Thread

Posting Permissions