1. #1
    Ext User
    Join Date
    Aug 2007
    Posts
    5
    Vote Rating
    0
    jfanaian is on a distinguished road

      0  

    Default [Solved] ComboBox options dissapear when one is selected

    [Solved] ComboBox options dissapear when one is selected


    I'm having a lot of trouble setting up a combobox. I got it to finally display the data using a JsonStore but I have to run combobox.setValue() for it to actually work, otherwise clicking on the arrow for the combobox displays nothing. Well, even with that it keeps fetching the data each time the dropdown is clicked. I don't want this, and I assumed it had to do with mode: 'remote' being default so I set it to local. Local also fixes fixes it so I don't have to do combobox.setValue() for it to display the options when the arrow is clicked. The only problem is that after the user makes a selection, the dropdown will only show the selection made and all other options are gone. Here is my code for the combobox and form, I have kept out all other field declarations.

    PHP Code:
            var field_category_store = new Ext.data.JsonStore({
                url: "<?=site_url('admin/category/get/json/'?>/" + (new Date().getTime()),
                fields: ['id', 'name']
            });
            var field_category = new Ext.form.ComboBox({
                store: field_category_store,
                fieldLabel: 'Category',
                valueField: 'id',
                displayField: 'name',
                hiddenName: 'category_id',
                emptyText: 'Select a category...',
                mode: 'remote',
                allowBlank: false,
                forceSelection: true
            });
            
            var product_form = new Ext.form.Form({
                labelAlign: 'right'
            });
        
            product_form.column({width: 430, labelWidth:120, style:'margin-left:8px;margin-top:8px'});
            product_form.fieldset(
                {id:'desc', legend:'Fill the form to create a new product'},
                field_name,
                field_description,
                field_category,
                field_image,
                field_quantity,
                field_price,
                field_shipping,
                field_status
            );
            
            product_form.applyIfToFields({width:255});
            product_form.render('productadd-form');
            product_form.end();
            
            field_category_store.baseParams['disableCaching'] = true;
            //field_category_store.on('load', function() {field_category.setValue(14);}, this, {single: true});
            field_category_store.load();
    I commented the on load listener for the category store because with mode: local I don't have to do this.

    Why do all other options disappear once one is selected?

    Thanks again

    EDIT: I would also like to poitn out that I am disabling caching because the application I am writing has URLs for better SEO, therefore the ?_dc=<timestamp> breaks the request.
    Last edited by jfanaian; 7 Aug 2007 at 7:23 AM. Reason: moved to Help from General

  2. #2
    Ext User
    Join Date
    Aug 2007
    Posts
    5
    Vote Rating
    0
    jfanaian is on a distinguished road

      0  

    Default


    Well, I was looking through the examples in the docs to see if there was anything different to what I was doing and I found the solution. I had to add

    triggerAction: 'all'

    To the combobox.

    It works! How awesome

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar