Problem when selecting in a combobox

Page 1 of 2 12 LastLast
  1. #1

    Problem when selecting in a combobox

    Hello

    I have a combobox, when I click to select a value, I choose one, but the value is not updated into the combobox text part (see picture of the process) :
    first I click to expand : ok
    second, and third I chosee, the combo collapsed, nothing appeared in the text part
    fourth, I click elsewhere an the value selected apear.

    Here the combo definition. I see nothing strange in it.

    <ext:ComboBox ID="ComboBox1"
        runat="server"
        Editable="false"
        Enabled="True" 
        DisplayField="STR_CountryName"
        ValueField="INT_idCountry" 
        EmptyText="Please choose a value">
        <Store>
            <ext:Store ID="Store3" runat="server">
                <Proxy>
                    <ext:HttpProxy Url="jsonDAL/ReturnJsonCountry.aspx" Json="false" Timeout="3000">
                    </ext:HttpProxy>
                </Proxy>
                <Reader>
                    <ext:JsonReader>
                        <Fields>
                            <ext:RecordField Name="INT_idCountry"  Type="Int"/>
                            <ext:RecordField Name="STR_CountryName" Type="String" />
                        </Fields>
                    </ext:JsonReader>
                </Reader>
            </ext:Store>
        </Store>
        <Listeners>
            <Expand Handler="#{ComboBox1}.store.reload();"/>
        </Listeners>
    </ext:ComboBox>
    The combobox defined below works well :

    <ext:ComboBox ID="ComboBox3"
        runat="server"
        Editable="false"
        Enabled="True" 
        DisplayField="STR_NameWorldRegion"
        ValueField="INT_idWorldRegion" 
        EmptyText="Please choose a value">
        <Store>
            <ext:Store ID="Store1" runat="server">
                <Proxy>
                    <ext:HttpProxy Url="jsonDAL/ReturnJsonWorldRegion.aspx" Json="false" Timeout="3000">
                    </ext:HttpProxy>
                </Proxy>
                <Reader>
                    <ext:JsonReader>
                        <Fields>
                            <ext:RecordField Name="INT_idWorldRegion"  Type="Int"/>
                            <ext:RecordField Name="STR_NameWorldRegion" Type="String" />
                        </Fields>
                    </ext:JsonReader>
                </Reader>
            </ext:Store>
        </Store>
        <Listeners>
            <Expand Handler="#{ComboBox3}.store.reload();"/>
        </Listeners>
    </ext:ComboBox>
    Attached Thumbnails Click image for larger version. 

Name:	Capt_120113_H105558_001.jpg 
Views:	81 
Size:	28.1 KB 
ID:	3701   Click image for larger version. 

Name:	Capt_120113_H105558_002.jpg 
Views:	58 
Size:	27.4 KB 
ID:	3702   Click image for larger version. 

Name:	Capt_120113_H105558_003.jpg 
Views:	66 
Size:	28.6 KB 
ID:	3703   Click image for larger version. 

Name:	Capt_120113_H105558_004.jpg 
Views:	64 
Size:	28.0 KB 
ID:	3704  
  2. #2
    Hi,

    What is a data populated to the Store?

    Please post a JSON object from a server response.
  3. #3
    Here we are :

    [{"INT_idCountry":6,"STR_CountryName":"Australia ","STR_NameWorldRegion":"Asia-Pacifique"},{"INT_idCountry":2,"STR_CountryName":"France ","STR_NameWorldRegion":"Europe"},{"INT_idCountry":1,"STR_CountryName":"Germany ","STR_NameWorldRegion":"Europe"},{"INT_idCountry":3,"STR_CountryName":"Switzerland ","STR_NameWorldRegion":"Europe"},{"INT_idCountry":4,"STR_CountryName":"United Kingdom ","STR_NameWorldRegion":"Europe"},{"INT_idCountry":5,"STR_CountryName":"USA ","STR_NameWorldRegion":"America"}]
  4. #4
    I can't see "INT_idWorldRegion" field in that JSON according to:

    ValueField="INT_idWorldRegion"
    
    <ext:RecordField Name="INT_idWorldRegion"  Type="Int"/>
    It means that all ComboBox's items will have the same value (some default, probably, a zero for Int RecordField).

    It causes the problem, because each ComboBox's item must have an unique value.
  5. #5
    Yes, you'r right, but my value field is INT_idcountry for that combobox. I can't have two value field no? Those with world region thing is for the second exemple I put in first post, but this works well.
  6. #6
    My fault, I've checked the second ComboBox what you are saying to be working correctly. Though I don't understand how it can work correctly with such data.

    To fix the first ComboBox, please replace:
    <Expand Handler="#{ComboBox1}.store.reload();"/>
    with
    <BeforeQuery Handler="delete queryEvent.combo.lastQuery;" />
    It also causes reloading a Store, but in recommend and working way.

    See also
    http://docs.sencha.com/ext-js/3-4/#!...erty-lastQuery
  7. #7
    I did what you said, but I have exactly the same phenomena.

    My fault, I've checked the second ComboBox what you are saying to be working correctly. Though I don't understand how it can work correctly with such data.
    perhaps because it works with those data:
    [{"INT_idWorldRegion":4,"STR_NameWorldRegion":"Africa"},{"INT_idWorldRegion":2,"STR_NameWorldRegion":"America"},{"INT_idWorldRegion":3,"STR_NameWorldRegion":"Asia-Pacifique"},{"INT_idWorldRegion":1,"STR_NameWorldRegion":"Europe"}]
    Here the combobx update with the modification you asked :

    <ext:ComboBox ID="ComboBox1"
        runat="server"
        Editable="false"
        Enabled="True" 
        DisplayField="STR_CountryName"
        ValueField="INT_idCountry" 
        EmptyText="Please choose a value">
        <Store>
            <ext:Store ID="Store3" runat="server">
                <Proxy>
                    <ext:HttpProxy Url="jsonDAL/ReturnJsonCountry.aspx" Json="false" Timeout="3000000">
                    </ext:HttpProxy>
                </Proxy>
                <Reader>
                    <ext:JsonReader>
                        <Fields>
                            <ext:RecordField Name="INT_idCountry"  Type="Int"/>
                            <ext:RecordField Name="STR_CountryName" Type="String" />
                        </Fields>
                    </ext:JsonReader>
                </Reader>
            </ext:Store>
        </Store>
        <Listeners>
            <BeforeQuery Handler="delete queryEvent.combo.lastQuery;" />
        </Listeners>
    </ext:ComboBox>
    Last edited by feanor91; Jan 13, 2012 at 12:54 PM.
  8. #8
    Again, I can't a field with ComboBox's ValueField in the JSON object.
  9. #9
    Quote Originally Posted by Daniil View Post
    Again, I can't a field with ComboBox's ValueField in the JSON object.
    Sorry I don't understand. What do you mean?

    I have another combobox that have the same behavior, maybe it will help :

    the combo definition :

    <ext:ComboBox 
        ID="cboEntity"
        runat="server"
        FieldLabel="Your entity name"
        Editable="false"
        Width="200" 
        StoreID="stoEntities" 
        AllowBlank="False" 
        EmptyText="Please choose a value..." 
        DisplayField="EntityName"
        ValueField="idRmdEntities"
        IndicatorIcon="BulletRed"
        IndicatorTip="This field is mandatory"
        LabelAlign="Right"
        LabelStyle="font:Verdana;">
    </ext:ComboBox>
    the store used to load it :

    <ext:Store ID="stoEntities" runat="server">
        <DirectEventConfig Json="false" ShowWarningOnFailure="False">
            <EventMask ShowMask="true" />
        </DirectEventConfig>
        <Proxy>
            <ext:HttpProxy Url="jsonDAL/ReturnJsonEntities.aspx" Json="false" Timeout="3000">
            </ext:HttpProxy>
        </Proxy>
        <Reader>
            <ext:JsonReader>
                <Fields>
                    <ext:RecordField Name="idRmdEntities" Mapping="INT_idRmdEntities"/>
                    <ext:RecordField Name="EntityName" Mapping="STR_EntityName" />
                </Fields>
            </ext:JsonReader>
        </Reader>        
    </ext:Store>
    and the JSON data :

    [{"INT_idRmdEntities":8,"STR_EntityName":"ResMed Limited "},{"INT_idRmdEntities":2,"STR_EntityName":"ResMed Lyon "},{"INT_idRmdEntities":1,"STR_EntityName":"ResMed Paris "},{"INT_idRmdEntities":4,"STR_EntityName":"ResMed Germany "},{"INT_idRmdEntities":6,"STR_EntityName":"ResMed Switzerland "},{"INT_idRmdEntities":16,"STR_EntityName":"ResMed UK "},{"INT_idRmdEntities":7,"STR_EntityName":"ResMed San Diego "}]
  10. #10
    Quote Originally Posted by feanor91 View Post
    Sorry I don't understand. What do you mean?
    I mean that you set up:
    DisplayField="STR_CountryName"
    ValueField="INT_idCountry"
    for the ComboBox, but there are no such fields in a JSON object that you bind to the ComboBox's Store.


    Too many ComboBoxes.

    Please provide a full sample with a single ComboBox to reproduce the problem.
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] Problem selecting items in Combobox
    By tlfdesarrollo in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jan 17, 2012, 6:57 PM
  2. Selecting value from ComboBox after binding
    By alexp in forum 1.x Help
    Replies: 0
    Last Post: Mar 30, 2011, 9:48 AM
  3. ComboBox Selecting Value using Text
    By speddi in forum 1.x Help
    Replies: 2
    Last Post: Apr 19, 2010, 3:11 AM
  4. combobox item selecting bug ! please help
    By relativ in forum 1.x Help
    Replies: 0
    Last Post: Nov 24, 2009, 4:31 AM
  5. Replies: 6
    Last Post: Mar 20, 2009, 5:39 PM

Posting Permissions