Results 1 to 9 of 9

Thread: Combobox selections

  1. #1
    Sencha User
    Join Date
    Jul 2010
    Location
    Belo Horizonte, Brazil
    Posts
    14

    Default Combobox selections

    I have been searching this forum extensively but couldn't find a viable solution to my problem. Maybe I'm using the wrong query. Anyway, I'm stuck.

    Picture this scenario (data is fictional, problem is not):

    Code:
    var test = [
        [1,'Ana','Smith'],
        [2,'Ana','Goldman'],
        [3,'Ana','McDonald']
    ];
    
    var store = new Ext.data.ArrayStore({
        fields:['id','fname','lname'],
        data:test
    });
    var formP = new Ext.FormPanel({
        id:'loginPanel',
        frame:true,
        items:[{
            xtype:'combo',
            store:store,
            mode:'local',
            displayField:'fname',
            valueField:'id',
            hiddenValue:'id',
            hiddenName:'idUser',
        }],
        buttons:[{
            text:'Enviar',
            listeners:{
                click:function(){
                    formP.getForm().submit({
                        url:'lib/php/checkLogin.php',
                        success:function(){
                            //
                        }
                    });
                }
            }        
        }]
    });
    Here's the problem, it doesn't matter which "Ana" I select, it always sends the first one. This is driving me nuts. Help anyone?

  2. #2
    Sencha User vishalnnsingh's Avatar
    Join Date
    Sep 2010
    Location
    Kolkata, India
    Posts
    115

    Default

    I tried to solve the problem but stuck too, never thot of it, i know in the real world it doesn't make sense using the same displayfield with different id unless you give a distinguing para in the display field, but still, now m thinking that is it the displayfield that the combobox uses to fetch the id from the store, because changing the diplayfield in the store i.e fname to three different values itself is solving the problem.
    I Meet Challenge with Excitement & My Only Gossip is Love

  3. #3
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    This is a know bug (fix here).

  4. #4
    Sencha User vishalnnsingh's Avatar
    Join Date
    Sep 2010
    Location
    Kolkata, India
    Posts
    115

    Default

    Thanx Condor...
    I Meet Challenge with Excitement & My Only Gossip is Love

  5. #5
    Sencha User
    Join Date
    Jul 2010
    Location
    Belo Horizonte, Brazil
    Posts
    14

    Default

    @vishalnnsingh

    It does make sense in the real world. Actually, it was generated because I had to implement exactly this situation and had to use a workaround. My real data is client_ID, client_Name, client_SerialNumber. Id and Serial Number are unique but the person who is going to select it cannot have access to ID or SN data, just the name and the same cliente name may have more than one serial number so that it does repeat the name.

    @Condor, thank you. I'll try the fix when I get home and reply back.

  6. #6
    Sencha User vishalnnsingh's Avatar
    Join Date
    Sep 2010
    Location
    Kolkata, India
    Posts
    115

    Default

    But how will you distinguish one ana from another ana, what if i want to debit 500$ to ana with serial no 567980, there must be someway for the user to know about which ana he/ she is chosing.
    Anyways maybe i am not looking at things from your point of view.
    I apologise if i am being a nuisance
    I Meet Challenge with Excitement & My Only Gossip is Love

  7. #7
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    There is indeed a problem if you make the combobox editable:true and start typing the name 'Ana'. In that case it will use the first 'Ana' from the list.

    The patch does however solve the problem when selecting the second 'Ana' from the list.

  8. #8
    Sencha User
    Join Date
    Jul 2010
    Location
    Belo Horizonte, Brazil
    Posts
    14

    Default

    No apology is necessary, vishalnnsingh. Your questioning is quite valid. Perhaps, if all of us explained our problems in detail, it would be easier to understand our scenario and deal with the problems more efficiently.

    In my case, the combobox has a suggest feature and the list of items loads asynchronously with a Ext.XTemplate, allowing the user to see data other than the cliente name. From these other data, she will choose the correct one.

  9. #9
    Sencha User vishalnnsingh's Avatar
    Join Date
    Sep 2010
    Location
    Kolkata, India
    Posts
    115

    Default

    Got you, thank you condor and brunowerneck
    I Meet Challenge with Excitement & My Only Gossip is Love

Similar Threads

  1. CellEditor: ComboBox (different selections per row)
    By paco_online in forum Ext GWT: Discussion
    Replies: 2
    Last Post: 30 Apr 2010, 8:35 AM
  2. ComboBox selections seem too sticky
    By Ben in forum Ext 1.x: Help & Discussion
    Replies: 0
    Last Post: 14 Jun 2007, 1:08 AM
  3. Events in ComboBox selections
    By maya in forum Ext 1.x: Help & Discussion
    Replies: 2
    Last Post: 22 Apr 2007, 10:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •