1. #1
    Sencha - Services Team arthurakay's Avatar
    Join Date
    Sep 2008
    Location
    Antioch, IL
    Posts
    1,369
    Vote Rating
    35
    arthurakay is a jewel in the rough arthurakay is a jewel in the rough arthurakay is a jewel in the rough

      0  

    Default ComboBox Grid editor issue

    ComboBox Grid editor issue


    I've been searching for answer to this question, but have been unable to find someone with exactly the same problem...

    I'm using a ComboBox() for an editor in one of my grid's columns. The ComboBox() uses a remote data source. Here's a look at the code:

    PHP Code:
    {
                
    header'Template Name'
                
    dataIndex'TemplateCode'
                
    id'TemplateCode',
                
    width200,
                
    editor: new Ext.form.ComboBox({
                    
    allowBlanktrue,
                    
    displayField'Value',
                    
    emptyText'Select a value',
                    
    mode'local',
                    
    selectOnFocustrue,
                    
    store: new Ext.data.JsonStore({
                        
    baseParams: { 
                            
    companyCodethisEntity.companyCode,
                            
    containerTypethisEntity.containerType
                        
    },
                        
    urlBasan.URL.CharacteristicTemplate.listAllUrl(),
                        
    sortInfo: { field'Value'direction"ASC" },
                        
    listeners: {
                            
    'load': function(storerecordArrayoptions) {
                                var 
    recordTemplate Ext.data.Record.create([
                                    { 
    name'Key' },
                                    { 
    name'Value' }
                                ]);

                                
    store.insert(
                                    
    0,
                                    new Array(
                                        new 
    recordTemplate({ KeyBasan.UI.emptyGuidValue'<< NONE >>'})
                                    )
                                );
                            }
                        }
                    }),
                    
    typeAheadtrue,
                    
    triggerAction'all',
                    
    valueField'Key',
                    
    listeners: { 
                        
    'select': function(thisBoxselectedRecordindex) {
                            
    dropDownRecord.fieldName 'TemplateName';

                            if (
    selectedRecord.get('text') == '<< NONE >>') {
                                
    dropDownRecord.value '';
                            }
                            else {
                                
    dropDownRecord.value selectedRecord.get('text');
                            }
                        },
                        
    'focus': function(thisBox) {
                            
    thisBox.getStore().load();
                        }
                    }
                }),
                
    renderer: function renderer(valcellrecord) {
                    var 
    displayName record.get('TemplateName');

                    if (
    displayName === '') {
                        return 
    '';
                    }
                    else {
                        return 
    displayName;
                    }
                }
            } 
    For starters, the column renderer works perfectly - no problems there.

    The problem I'm seeing is a result of latency (see attached images). When the user clicks into the cell to select a value, the ComboBox() displays the underlying value for a split second. Once the data store has loaded, the ComboBox() displays the correct display value.

    I'm guessing there's a way for me to override the default display of that ComboBox(), but I've been unsuccessful in trying to do so. Can anyone point me in the right direction?
    Attached Images
    Arthur Kay
    Developer Relations Manager, Sencha Inc.

    Twitter | Sencha Chicago User Group