PDA

View Full Version : [CLOSED] CellEditing does not place the editor correctly in the grid



PeterParsonage
Jul 22, 2015, 12:14 AM
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>

Daniil
Jul 22, 2015, 10:21 AM
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>

PeterParsonage
Jul 22, 2015, 5:49 PM
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.

Daniil
Jul 23, 2015, 8:24 AM
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.