Feb 22, 2012, 3:52 PM
[CLOSED] Combo initialization with no selection on window show.
Hi
I am using an embedded <ext:Window> with a combo control to add an item to the opener page.
Each time that window shows I set the datasource to the combo with fresh data, but want the combo to show no selection.
The first time the window opens, the combo shows the "EmptyText" ('Seleccionar', that means 'Select' in Spanish).
Once the window is closed and shown again, the combo receives the new fresh datasource (Set every time a DirectEvent shows the popup window), but the combo remembers its last selection.
I want it always to show the EmptyText.
I tried setting selectedInedex = -1, but doesn't work. I can set selectedIndex = 0, and there the first item is shown always, but I don't want that. Also I belive that if no items are added by datasource, that index will produce an error.
Tried using closeAction='close', but I believe the window can't be rendered again calling the show() method a second time (I saw that in a post).
Just for your reference, 'Idioma' means 'language', 'Mostrar' means 'Show', 'Ventana' means 'Window' and 'Agregar' means 'Add' in Spanish
The opening code:
Regards
Fernando
I am using an embedded <ext:Window> with a combo control to add an item to the opener page.
Each time that window shows I set the datasource to the combo with fresh data, but want the combo to show no selection.
The first time the window opens, the combo shows the "EmptyText" ('Seleccionar', that means 'Select' in Spanish).
Once the window is closed and shown again, the combo receives the new fresh datasource (Set every time a DirectEvent shows the popup window), but the combo remembers its last selection.
I want it always to show the EmptyText.
I tried setting selectedInedex = -1, but doesn't work. I can set selectedIndex = 0, and there the first item is shown always, but I don't want that. Also I belive that if no items are added by datasource, that index will produce an error.
Tried using closeAction='close', but I believe the window can't be rendered again calling the show() method a second time (I saw that in a post).
Just for your reference, 'Idioma' means 'language', 'Mostrar' means 'Show', 'Ventana' means 'Window' and 'Agregar' means 'Add' in Spanish
The opening code:
<ext:Button runat="server" ID="btnAgregarIdioma" Text="+" Width="20">
<DirectEvents>
<Click OnEvent="MostrarVentanaIdiomas"></Click>
</DirectEvents>
</ext:Button>
The serverside DirectEvent:Protected Sub MostrarVentanaIdiomas()
'HERE, NOT RELEVANT CODE TO OBTAIN DATATABLE FOR DATASOURCE
Me.IdiomasAgregarStore.DataSource = mDs.Tables(0)
Me.IdiomasAgregarStore.DataBind()
Me.VentanaIdiomas.Show()
Me.cmbIdiomasAgregar.SelectedIndex = -1 'HERE IT IS SUPOSED I FORCE THE COMBO TO SHOW THE EMPTY TEXT
VentanaIdiomas.Center()
End Sub
The popup window:<ext:Window
ID="VentanaIdiomas"
runat="server"
Icon="WorldAdd"
Title="Agregar traducción"
Hidden="true"
Modal="true"
InitCenter="true"
Width="300px"
Height="80px"
Padding="0"
>
<Items>
<ext:FormPanel runat="server" Padding="5" AutoHeight="true" ButtonAlign="Right" >
<Items>
<ext:ComboBox runat="server" ID="cmbIdiomasAgregar"
FieldLabel="Idioma"
StoreID="IdiomasAgregarStore"
DisplayField="Idioma_Nombre"
ValueField="Idioma_Id"
AllowBlank="false"
EmptyText="Seleccionar"
InvalidText="Debe seleccionar un idioma para agregar"
ForceSelection="true"
Editable="false"
TypeAhead="false">
</ext:ComboBox>
</Items>
<Buttons>
<ext:Button runat="server" ID="btnAgregar" Text="Agregar" Margins="0">
</ext:Button>
<ext:Button runat="server" ID="btnCancelarIdiomas" Text="Cancelar" Margins="0">
</ext:Button>
</Buttons>
</ext:FormPanel>
</Items>
</ext:Window>
ThanksRegards
Fernando
Last edited by geoffrey.mcgill; Feb 22, 2012 at 5:37 PM.
Reason: [CLOSED]