Wait! Looks like we don't have enough information to add this to bug database. Please follow this template bug format.
  1. #1
    Sencha User
    Join Date
    May 2012
    Posts
    5
    Vote Rating
    0
    Chrischan is on a distinguished road

      0  

    Default [4.0.7] ComboBox: setted to empty string when typing while a remote query is running

    [4.0.7] ComboBox: setted to empty string when typing while a remote query is running


    REQUIRED INFORMATION

    Ext version tested:
    • Ext 4.0.7
    Browser versions tested against:
    • Mozilla Firefox 18.0.1
    • Chrome 24
    Description:
    • Ext.form.field.ComboBox: When typing something into the textfield while a remote query is currently running, the value of the combobox will be setted to an empty value if the query result is empty.
    • The problem begins in ComboBox.onLoad (comments edited):
      Code:
      onLoad: function() {
              var me = this,
                  value = me.value;
      
              if (me.rawQuery) {
                  me.rawQuery = false;
                  me.syncSelection();
                  if (me.picker && !me.picker.getSelectionModel().hasSelection()) {
                      me.doAutoSelect();
                  }
              }
              // rawQuery is false is the second query (resetted by the first query), so were are here
              else {
                  if (me.value) {
                      me.setValue(me.value);
                  // we don't have selected a value
                  } else {
                      if (me.store.getCount()) {
                          me.doAutoSelect();
                      } else {
                          // store is empty, so this is called
                          me.setValue('');
                      }
                  }
              }
          }
    • Next problem is in setValue:
      Code:
              if (me.store.loading) {
                  me.value = value;
                  me.setHiddenValue(me.value);
                  return me;
              }
      store.loading is false in the second query because it is setted to false after the first query has been finished. This is problematic because the second query is sent after the first one is finished.
    Steps to reproduce the problem:
    • Create a combobox with queryMode="remote".
    • Type a value into the field of the box.
    • While query is running, change the value to something for that no result will be found.
    The result that was expected:
    • The field should keep the entered value.
    The result that occurs instead:
    • The box will be setted to an empty value.
    Test Case:
    Code:
    Ext.create("Ext.form.field.ComboBox", {
        columnWidth: 1,
        displayField: "display",
        minChars: 2,
        queryDelay: 150,
        queryMode: "remote",
        //queryParam: "search",
        renderTo: document.body,
        store: Ext.create("Ext.data.Store", {
            proxy: {
                reader: "json",
                type: "ajax",
                url: "some url (should take a moment to load)"
            }
        }),
        triggerAction: "query",
        valueField: "value",
        width: 400
    });


    HELPFUL INFORMATION


    Possible fix:
    • An approach could be to set store.loading to something like a counter. Increment it after sending a query and decrement it after a query has been finished. This way store.isLoading will return the correct value even for concurrent queries.
    Operating System:
    • Max OS X 10.6.8 (but should not matter)
    Last edited by Chrischan; 25 Jan 2013 at 8:00 AM. Reason: simplified example code

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,633
    Vote Rating
    817
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    The first request should be canceled.

    Have you tried this in a newer release? 4.0.7 is quite old now.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    May 2012
    Posts
    5
    Vote Rating
    0
    Chrischan is on a distinguished road

      0  

    Default


    I tested it with 4.1.1a, the bug still occurs.

  4. #4
    Sencha User
    Join Date
    May 2012
    Posts
    5
    Vote Rating
    0
    Chrischan is on a distinguished road

      0  

    Default


    Wait! Looks like we don't have enough information to add this to bug database. Please follow this template bug format.
    Which information is missing?

Thread Participants: 1