[CLOSED] How to initial selected item for combobox when its store is jsonstore?
Hi,everyone!
How to initial selected item for combobox when its store is jsonstore?
RE: [CLOSED] How to initial selected item for combobox when its store is jsonstore?
You could add a SelectedItem within the combo box body and set the value or text to the value you need to be selected, here's an example:
Code:
<ext:ComboBox StoreID="Store1" ID="ComboBox1" runat="server">
<SelectedItem Value="1" />
</ext:ComboBox>
or by using text:
Code:
<ext:ComboBox StoreID="Store1" ID="ComboBox1" runat="server">
<SelectedItem Text="UK" />
</ext:ComboBox>
hope this helps,
RE: [CLOSED] How to initial selected item for combobox when its store is jsonstore?
Hi,
May be I misunderstood you but the predefined selection does not depend on the store.
Just set for combobox and selection will be set after store load
Code:
<SelectedItem Value="1" />
Hope this help
RE: [CLOSED] How to initial selected item for combobox when its store is jsonstore?
that's what I said, but there is a problem I could not find a way to do it. How we can bind a value to the selected Item.
if I use it like this
Code:
<SelectedItem Value='<%# Eval("Id") %>'/>
this will throw this exception:
Databinding
expressions are only supported on objects that have a DataBinding
event. Coolite.Ext.Web.ListItem does not have a DataBinding event.
What we can do? is their anyway to do it without handling this situation it in the code?
RE: [CLOSED] How to initial selected item for combobox when its store is jsonstore?
Thank you!
Maybe I should post my code here.
html:
Code:
<ext:Store runat="server" ID="stoDiv" AutoLoad="true">
<ext:Button ID="cmdFilDiv" runat="server" Text="Advance" Icon="ServerEdit">
cs:
in Page_Load()
Code:
//initial store
store = stoDiv;
store.Reader.Clear();
// add JsonReader
store.Reader.Add(t.Reader);
store.Proxy.Clear();
// add HttpProxy
store.Proxy.Add(t.Proxy);
store.AutoLoad = true;
iniCombo(cboDiv);
cboDiv.StoreID = storeID;//set store for combobox
Now how to initialize selected item for combobox in codebehide? please help me. Thank you!
RE: [CLOSED] How to initial selected item for combobox when its store is jsonstore?
I want to set combobox's selected item to first item.
RE: [CLOSED] How to initial selected item for combobox when its store is jsonstore?
*It seem's that Combo box SelectedIndex will be avalible at 0.7 version, I am using 0.6 and their is no such property to set the selected index.
Take a look at this post:*http://forums.ext.net/showthread.php...combobox+width
hope this helps,
RE: [CLOSED] How to initial selected item for combobox when its store is jsonstore?