Results 1 to 5 of 5

Thread: Extjs Combobox remote query double loading

  1. #1

    Default Answered: Extjs Combobox remote query double loading

    I have a problem with my combobox. Combobox load when i open my form panel and he get a query send by database. But when i click a trigger icon, he do the same query. I would to disable the query when i click a trigger icon.

    My combobox code:
    HTML Code:
    xtype: 'combobox',
    fieldLabel: 'Operation',
    id: 'combotypeoperation',
    store: 'TypeOperations',
    queryMode: 'remote',
    displayField: 'libelle',
    editable: false,
    valueField: 'idTypeOperation',
    listConfig: {
             loadMask: false
    },
    listeners: {
             render: function() {
                     this.store.load();
            }
    }                                      
    TypeOperations store code:
    HTML Code:
    Ext.define(
            'SecureDT.store.TypeOperations',
            {
                  extend: 'Ext.data.Store',
                  requires: [
                    'SecureDT.model.TypeOperation'
                  ],
                  model: 'SecureDT.model.TypeOperation',
                
                  proxy: {
                           type: 'ajax',
                           timeout: 120000,
                          url: 'secureDT/typeOperation/findAll.json',
                          reader: {
                                type: 'json',
                                root: 'data'
                         }
                 },
                 listeners: {
                    load: function() {
                        var combo = Ext.getCmp('combotypeoperation');
                        var recordSelected = combo.getStore().getAt(0).get('idTypeOperation');
                        combo.setValue(recordSelected);
                    }
                }
            }
    );

  2. Have you tried queryMode: 'local' ?

    In queryMode: 'remote', the ComboBox loads its Store dynamically based upon user interaction.

  3. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,410
    Answers
    716

    Default

    You can remove the query as follows:

    Code:
    listeners: {
        beforequery: function(qe){
            delete qe.combo.lastQuery;
        }           
    }

  4. #3

    Default

    thank scottmartin for you reply. I put you code in my combobox view but he do the double request.
    I would loading all combobox values in database when user click to open the form before he chose the informations by trigger clicking.

    Code:
    {
         xtype: 'combobox',
         fieldLabel: 'Operation',
         id: 'combotypeoperation',
         store: 'TypeOperations',
         queryMode: 'remote',
         displayField: 'libelle',
         editable: false,
         valueField: 'idTypeOperation',
         enableKeyEvents: true,
         listConfig: {
               loadMask: false
         },
         listeners: {
              beforequery: function(qe){
                   delete qe.combo.lastQuery;
             }, 
             render: function() {
                  this.store.load();
             }
        }
    }

  5. #4
    Sencha User carol.ext's Avatar
    Join Date
    Jun 2007
    Location
    Littleton, Colorado, USA
    Posts
    707
    Answers
    25

    Default

    Have you tried queryMode: 'local' ?

    In queryMode: 'remote', the ComboBox loads its Store dynamically based upon user interaction.

  6. #5

    Default

    lIt work now. Thk carol.ext. I think that when i get informations form database queryMode is 'remote'. Thk

Tags for this Thread

Posting Permissions

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