[CLOSED] How to initial selected item for combobox when its store is jsonstore?

  1. #1

    [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?
  2. #2

    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:

      
     <ext:ComboBox StoreID="Store1" ID="ComboBox1" runat="server">
         <SelectedItem Value="1" />
         </ext:ComboBox>
    or by using text:

      
    
     <ext:ComboBox StoreID="Store1" ID="ComboBox1" runat="server">
    
         <SelectedItem Text="UK" />
    
         </ext:ComboBox>
    hope this helps,
  3. #3

    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
    <SelectedItem Value="1" />
    Hope this help


  4. #4

    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
    <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?
  5. #5

    RE: [CLOSED] How to initial selected item for combobox when its store is jsonstore?

    Thank you!
    Maybe I should post my code here.

    html:
    
                 <ext:Store runat="server" ID="stoDiv" AutoLoad="true">
                 <ext:Button ID="cmdFilDiv" runat="server" Text="Advance" Icon="ServerEdit">
    cs:
    in Page_Load()
                 //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!
  6. #6

    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.
  7. #7

    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,


  8. #8

    RE: [CLOSED] How to initial selected item for combobox when its store is jsonstore?

    OK! Thank you!

Similar Threads

  1. [CLOSED] Always selected Item is nothing for combobox as menu item
    By rnachman in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 04, 2011, 4:51 PM
  2. [CLOSED] get the value of the selected item from a combobox via js
    By Edward in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Oct 03, 2010, 12:06 PM
  3. [CLOSED] ComboBox set selected item value
    By pumpkin in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Sep 27, 2009, 7:26 AM
  4. Get Combobox Selected item
    By yarlenvas in forum 1.x Help
    Replies: 3
    Last Post: Mar 08, 2009, 2:04 PM
  5. Get ComboBox Selected Item
    By speedstepmem3 in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Nov 18, 2008, 9:50 AM

Posting Permissions