Jun 24, 2009, 5:52 PM
Combo items not showing in FormLayout
I'm saw an example here and was attempting to pull off the same thing. My form is practically identical to the example except for the FieldSet, but for some reason the Items for my Combo doesn't show.
I copied the same Store and Combobox to another page and items were shown there. After that I used FireBug to check if my Store had data on the page giving the problem and it did. So someone please point out to me where I went wrong with this.
Here's my code. Please bear in mind that this code is from a user control that is on a page with a grid. As i said, Its pretty much identical to the example.
I copied the same Store and Combobox to another page and items were shown there. After that I used FireBug to check if my Store had data on the page giving the problem and it did. So someone please point out to me where I went wrong with this.
Here's my code. Please bear in mind that this code is from a user control that is on a page with a grid. As i said, Its pretty much identical to the example.
<ext:Store ID="storeAccessLevels" runat="server"
AutoLoad="true">
<Reader>
<ext:JsonReader ReaderID="AccessLevelId">
<Fields>
<ext:RecordField Name="AccessLevelId" />
<ext:RecordField Name="LevelName" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
<ext:Window ID="userDetailsWindow" runat="server" Icon="User" Title="<%$ Resources:Text, UserDetails %>"
Width="400" Height="410" AutoShow="false" Modal="true" Showonload="false">
<Body>
<ext:FitLayout ID="FitLayout1" runat="server">
<ext:TabPanel ID="TabPanel1" runat="server" ActiveTabIndex="0" Border="false" DeferredRender="false">
<Tabs>
<ext:Tab runat="server" ID="tabGeneralInfo" Title="<%$ Resources:Text, GeneralInfo %>" Icon="Vcard"
BodyStyle="padding:5px;">
<Body>
<ext:FieldSet runat="server" CheckboxToggle="false" Title="<%$ Resources:Text, UserInfo %>" AutoHeight="true">
<Body>
<ext:FormLayout runat="server">
<ext:Anchor>
<ext:TextField ID="txtUserName" runat="server" FieldLabel="<%$ Resources:Text, Username %>" Width="250"
Disabled="true" />
</ext:Anchor>
<ext:Anchor>
<ext:ComboBox ID="cbxAccessLevels" runat="server" StoreID="storeAccessLevels" FieldLabel="<%$ Resources:Text, AccessLevel %>"
AllowBlank="true"
EmptyText="<%$ Resources:Text, All %>"
Selectonfocus="true"
DisplayField="LevelName"
ValueField="AccessLevelId"
TypeAhead="true"
Mode="Local"
TriggerAction="All"
ForceSelection="true" />
</ext:Anchor>
<ext:Anchor>
<ext:TextField ID="txtExtension" runat="server" FieldLabel="<%$ Resources:Text, Extension %>" Width="250" />
</ext:Anchor>
<ext:Anchor>
<ext:Checkbox ID="chkEnabled" runat="server" FieldLabel="<%$ Resources:Text, Enabled %>" Checked="false" />
</ext:Anchor>
<ext:Anchor>
<ext:Checkbox ID="chkLockedOut" runat="server" FieldLabel="<%$ Resources:Text, LockedOut %>" Checked="false" />
</ext:Anchor>
</ext:FormLayout>
</Body>
</ext:FieldSet>
<ext:FieldSet runat="server" CheckboxToggle="false" Title="<%$ Resources:Text, PersonalInfo %>" AutoHeight="true">
<Body>
<ext:FormLayout runat="server">
<ext:Anchor>
<ext:TextField ID="txtFirstName" runat="server" FieldLabel="<%$ Resources:Text, FirstName %>" Width="250" />
</ext:Anchor>
<ext:Anchor>
<ext:TextField ID="txtLastName" runat="server" FieldLabel="<%$ Resources:Text, LastName %>" Width="250" />
</ext:Anchor>
<ext:Anchor Horizontal="100%">
<ext:TextField ID="txtEmailAddress" runat="server" FieldLabel="<%$ Resources:Text, EmailAddress %>" Vtype="email" />
</ext:Anchor>
<ext:Anchor>
<ext:DateField ID="dfCreatedDate" runat="server" FieldLabel="<%$ Resources:Text, DateAdded %>" Width="250"
Disabled="true" />
</ext:Anchor>
</ext:FormLayout>
</Body>
</ext:FieldSet>
</Body>
</ext:Tab>
<ext:Tab ID="tabLoginInfo" runat="server" Title="<%$ Resources:Text, GeneralInfo %>" Icon="DoorIn" BodyStyle="padding:5px;">
<Body>
</Body>
</ext:Tab>
</Tabs>
</ext:TabPanel>
</ext:FitLayout>
</Body>
<Buttons>
<ext:Button ID="btnSave" runat="server" Text="<%$ Resources:Text, Save %>" Icon="Disk">
<AjaxEvents>
<Click OnEvent="SaveUser" Failure="Ext.MessageBox.alert('Saving failed', 'Error during ajax event');">
<EventMask ShowMask="true" Target="CustomTarget" CustomTarget="={#{userDetailsWindow}.body}" />
</Click>
</AjaxEvents>
</ext:Button>
<ext:Button ID="btnCancel" runat="server" Text="<%$ Resources:Text, Close %>" Icon="Cancel">
<Listeners>
<Click Handler="#{userDetailsWindow}.hide(null);" />
</Listeners>
</ext:Button>
</Buttons>
</ext:Window>
protected void Page_Load(object sender, EventArgs e)
{
if (!Ext.IsAjaxRequest)
{
BindAccessLevels();
}
}
#region Data Methods
/// <summary>
/// Bind the data required for the combobox.
/// </summary>
private void BindAccessLevels()
{
AccessLevelModelCollection collection;
collection = AccessLevelsDataClient.RetrieveAccessLevelsForCombo();
if (collection != null)
{
storeAccessLevels.DataSource = collection;
storeAccessLevels.DataBind();
}
}
#endregion