Mar 23, 2010, 9:09 AM
[CLOSED] [1.0] Remove fields from FormPanel
In the example below, I've added a button that when clicked will remove all the fields from the FormPanel. This removes all the field controls, but doesn't remove the associated FieldLabels.
I've tried both the "FormPanel.remove" and "FormPanel.removeAll" methods, and these don't appear to work. Am I missing something, or is this a bug?
Thanks,
Dan
I've tried both the "FormPanel.remove" and "FormPanel.removeAll" methods, and these don't appear to work. Am I missing something, or is this a bug?
Thanks,
Dan
<%@ Page Language="C#" %>
<%@ 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 id="Head1" runat="server">
<script type="text/javascript">
function deleteAllFields()
{
for (var i = 0; i < frmDetails.items.length; i++)
{
frmDetails.remove(frmDetails.items.items[i]);
i--;
}
frmDetails.removeAll();
frmDetails.doLayout();
}
</script>
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server">
</ext:ResourceManager>
<ext:FormPanel
Title="Details"
Frame="true"
LabelWidth="200"
Width="800"
Height="600"
id="frmDetails"
BodyStyle="padding: 6px;"
runat="server">
<Defaults>
<ext:Parameter Name="Anchor" Value="97%"></ext:Parameter>
</Defaults>
<Items>
<ext:TextArea runat="server" ID="txtTest" FieldLabel="Field 1" AllowBlank="false"></ext:TextArea>
<ext:TextArea runat="server" ID="txtTest1" FieldLabel="Field 2" AllowBlank="false"></ext:TextArea>
<ext:TextArea runat="server" ID="txtTest2" FieldLabel="Field 3" AllowBlank="false"></ext:TextArea>
</Items>
<BottomBar>
<ext:Toolbar ID="toolbarMain" runat="server">
<Items>
<ext:Button ID="btnRender" runat="server" Text="Delete all fields">
<Listeners>
<Click Fn="deleteAllFields"></Click>
</Listeners>
</ext:Button>
</Items>
</ext:Toolbar>
</BottomBar>
</ext:FormPanel>
</form>
</body>
</html>