PDA

View Full Version : How to use SelectField in Formpanel



rickywu
Mar 28, 2017, 7:13 AM
I use SelectField in one single page directly but got error when tap select field:
Uncaught TypeError: Cannot read property 'add' of undefined

Did I missed any thing?



<%@ Page Language="C#" %>

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
}
}

public void HandleSelection(object sender, DirectEventArgs e)
{
}
public static readonly object SelectedEntry = new { value = "ca" };
</script>

<!DOCTYPE html>

<html>
<head runat="server">
<title></title>
</head>
<body>
<ext:ResourceManager runat="server" />

<ext:FormPanel ID="basicform" runat="server">
<Items>
<ext:FieldSet
runat="server"
ID="fieldset1"
Title="A"
Instructions="">
<Defaults>
<ext:Parameter Name="labelWidth" Value="35%" />
</Defaults>
<Items>
<ext:TextField
runat="server"
Name="name"
Label="Name"
PlaceHolder="Tom Roy"
AutoCapitalize="true"
Required="true"
ClearIcon="true" />
<ext:SpinnerField
runat="server"
Name="spinner"
Label="Spinner"
MinValue="0"
MaxValue="10"
StepValue="1"
Cycle="true">
</ext:SpinnerField>
<ext:Checkbox
runat="server"
Name="cool"
Label="Cool" />
<ext:SelectField
ID="SelectField1"
runat="server"
Label="Location"
AutoDataBind="true"
Selection="<%# SelectedEntry %>">
<Options>
<ext:ListItem Text="Brazil" Value="br" />
<ext:ListItem Text="Canada" Value="ca" />
<ext:ListItem Text="Russia" Value="ru" />
<ext:ListItem Text="Turkey" Value="tk" />
</Options>
<DirectEvents>
<Initialize OnEvent="HandleSelection">
<ExtraParams>
<ext:Parameter Name="value" Value="item.getSelection().data.value" Mode="Raw" />
</ExtraParams>
</Initialize>
<Change OnEvent="HandleSelection">
<ExtraParams>
<ext:Parameter Name="value" Value="newValue.data.value" Mode="Raw" />
</ExtraParams>
</Change>
</DirectEvents>
</ext:SelectField>
<ext:Slider
runat="server"
Name="slider"
Label="Slider" />
<ext:ToggleField
runat="server"
Name="toggle"
Label="Toggle" />
<ext:TextArea
runat="server"
Name="bio"
Label="Bio" />
</Items>
</ext:FieldSet>
</Items>
</ext:FormPanel>
</body>
</html>