Results 1 to 2 of 2

Thread: ComboBox custom template

  1. #1
    Sencha User bkraut's Avatar
    Join Date
    Nov 2007
    Location
    Maribor, Slovenia
    Posts
    403

    Default ComboBox custom template

    Hi,

    I created custom template for the combo box. Here is an example:

    PHP Code:
    this.combo = new Ext.form.ComboBox({
                
    tpl'<tpl for=".">'
                         
    '<div style="float: left;width: 120px; padding: 2px;height: 14px;overflow: hidden">{shortTitle}</div>' 
                        
    '<div style="float: left;border-left: 1px solid #CCC;padding: 2px;width: 200px;height: 14px;overflow: hidden">{longTitle}</div>' 
                        
    '<div style="float: right;border-left: 1px solid #CCC;padding: 2px;width: 120px;height: 14px;overflow: hidden">{address}</div>'
                        
    '</tpl>',
                
    allowBlankfalse,
                
    fieldLabel'Subject',
                
    name'subjectChooser',
                
    storestore,
                
    displayField'shortTitle',
                
    growtrue,
                
    hiddenNamethis.fieldName,
                
    valueField'id',
                
    emptyText'Select Subject ...',
                
    selectOnFocustrue,
                
    mode'local',
                
    triggerAction'all',
                
    forceSelectiontrue,
                
    width250,
                
    listWidth500,
                
    listeners: {
                    
    select: function(comborecordindex) {
                        
    this.setForm(record);    
                    },
                    
    scopethis                        
                
    }
            }); 
    Now I have all the values in the list, but I can not select any value. Is there anything else that I have to do?
    Best regards

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

    Default

    Yes, you forgot to specify an itemSelector.

    The problem is that your current template doesn't really contain a suitable target for itemSelector.
    I would recommend putting an extra <div class="x-combo-list-item"> around the three divs (the default itemSelector is '.x-combo-list-item').

Posting Permissions

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