Results 1 to 5 of 5

Thread: ComboBox problem

  1. #1

    Exclamation ComboBox problem

    Hi. I have problem with ComboBox when server returns empty value for it. Here is how I set it up:
    Code:
                var form = new Ext.form.FormPanel({
                    baseCls: 'x-plain',
                    labelWidth: 55,
                    defaultType: 'textfield',
    
                    reader : new Ext.data.XmlReader({
                            record : 'record'
                        }, [ 'id', 'name', 'code', 'desc', 'tcode']
                    ),
    
                    items: [{
                        xtype: 'hidden',
                        name: 'id'
                    },{
                        fieldLabel: 'Code',
                        name: 'code',
                        anchor: '100%'
                    },{
                        fieldLabel: 'Name',
                        name: 'name',
                        anchor:'100%'  // anchor width by percentage
                    },{
                        xtype: 'combo',
                        fieldLabel: 'Type',
                        name: 'tcode',
                        anchor: '100%',
                        editable: false,
                        valueField:'id',
                        displayField: 'text',
                        lazyInit : false,
                        emptyText : 'Select type',
                        forceSelection : true,
                        store: new Ext.data.JsonStore({
                            url: 'DataUManage.dat?m_type=data_gen_types&m_filt=UserGroup',
                            fields: ['id', 'text'],
                            autoLoad : true
                        })
                    }, {
                        xtype: 'textarea',
                        hideLabel: true,
                        name: 'desc',
                        anchor: '100% -83'  // anchor width by percentage and height by raw adjustment
                    }]
                });
    Im using this to edit or create some object. It works fine when ComboBox reader gets data for existing object in the DB. Problem is when server returns empty values for all fields in the form. In that case ComboBox is empty (as I want it to be) but when I click on the drop-list arrow nothing happens. All is working fine when server returns values for existing object. It almost feels that if value is not belongs to the list then ComboBox is stuck and dont allow you to pick anything.

  2. #2

    Default

    do u find that you have 2 'id's in your code?,but they are different thing:
    reader : new Ext.data.XmlReader({
    record : 'record'
    }, [ 'id', 'name', 'code', 'desc', 'tcode']
    ),
    ....
    store: new Ext.data.JsonStore({
    url: 'DataUManage.dat?m_type=data_gen_types&m_filt=UserGroup',
    fields: ['id', 'text'],
    autoLoad : true
    })

  3. #3

    Default

    Not sure Im following. Top one is mapping for reading form fields and bottom for reading list for the ComboBox.

  4. #4
    Sencha User
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    What exactly is an 'empty' value (I would recommend to use '' or null and not undefined).

    You probably also need this fix for ComboBox.

  5. #5

    Default

    Thank you! Apparently setting triggerAction: 'all' did the trick.

Posting Permissions

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