1. #1
    Sencha User
    Join Date
    Apr 2009
    Posts
    34
    Vote Rating
    0
    spiderweb is on a distinguished road

      0  

    Default ComboBox is not auto highlighting selected item on expand dropdown list

    ComboBox is not auto highlighting selected item on expand dropdown list


    I have a combobox with store loading remotely by DWR service, and also I have a tpl and itemSelector defined for the combo. If I select an item from the list other that the first one, when I expand the list, the first element is always highlighted, not the one that is selected in the combo. How do I make the selected element be highlighted when I expand the list? I'm guessing it has something to do with the tpl and the itemSelector...

    Code:
    xtype: 'combo',
                    id: 'graph-select-combo',
                    width: 800,
                    store : new Ext.data.Store({
                        reader : new Ext.data.ArrayReader({
                             fields: [{name: 'packageName'},
                                      {name: 'source'},
                                      {name: 'target'},
                                      {name: 'status'}
                                  ]
                        }),
                        proxy : new Ext.ux.data.DWRProxy({
                            dwrFunction : DWRService.getAllResults,
                            dwrTimeout : 30000,                
                            listeners: { 'beforeload': function(dataProxy, params) {
                                params[dataProxy.loadArgsKey] = [this.id];
                            }.createDelegate(this)
                    }
    
                        })
                    }),
                    triggerAction: 'all',
                    editable: false,
                    tpl : new Ext.XTemplate(
                        '<tpl for=".">',
                            '<div>',
                                '<span>Source: {source}, Target: {target}, Component: {packageName}</span>',
                            '</div>',
                        '</tpl>'),
                    itemSelector : 'div',
                    listeners: {
                        select : function(thisField, record, index){
                            this.source = record.data.source;
                            this.target = record.data.target;
                            this.packageName = record.data.packageName;
                            thisField.setValue('Source: ' + this.source + ', Target: ' + this.target + ', Component: ' + this.packageName);
                            this.refresh();
                        }.createDelegate(this)
                    }
                }]
            });

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,546
    Vote Rating
    64
    Animal is a jewel in the rough Animal is a jewel in the rough Animal is a jewel in the rough

      0  

    Default


    How is it supposed to know?

    What field should it pull out of the selected Record to use as its value when you select a row of the list?

  3. #3
    Sencha User
    Join Date
    Apr 2009
    Posts
    34
    Vote Rating
    0
    spiderweb is on a distinguished road

      0  

    Default


    Are you implying that i should use valueField config on the combo?

  4. #4
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,546
    Vote Rating
    64
    Animal is a jewel in the rough Animal is a jewel in the rough Animal is a jewel in the rough

      0  

    Default


    Yes. Otherwise there is no way of it relating back to a particular Record in the Store.

  5. #5
    Sencha User
    Join Date
    Apr 2009
    Posts
    34
    Vote Rating
    0
    spiderweb is on a distinguished road

      0  

    Default


    Can I use something like a combination of multiple fields from the record store, because there is no unique field in my results?

  6. #6
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,546
    Vote Rating
    64
    Animal is a jewel in the rough Animal is a jewel in the rough Animal is a jewel in the rough

      0  

    Default


    Yes, you can use a convert function on a special PK field to pull the bits together in one value.

Similar Threads

  1. Scroll to an selected Item in a List
    By milo08 in forum Sencha Touch 1.x: Discussion
    Replies: 8
    Last Post: 2 Dec 2012, 11:52 PM
  2. Selected item in select (dropdown menu).
    By ediew in forum Sencha Touch 1.x: Discussion
    Replies: 0
    Last Post: 27 Jul 2010, 4:12 AM
  3. Combobox - Stop auto-filtering dropdown list
    By quantass in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 17 Nov 2007, 9:16 AM

Thread Participants: 1

Tags for this Thread