Page 4 of 4 FirstFirst ... 234
Results 31 to 35 of 35

Thread: [OPEN]ComboBox's setValue call with a remotely loaded Store

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #31
    Sencha User
    Join Date
    Feb 2009
    Location
    Germany, Nuremberg
    Posts
    39

    Default

    Probably never) I faced this problem in ExtJS 6

  2. #32
    Sencha Premium User d.zucconi's Avatar
    Join Date
    Jun 2008
    Location
    Piacenza (Italy)
    Posts
    102

    Default

    + 1

  3. #33
    Sencha Premium Member
    Join Date
    May 2010
    Location
    Guatemala, Central America
    Posts
    1,560

    Default

    I'm starting a new app with SA + ExtJS 6.2 and need to use a combo with a huge table (products) in edit mode, I mean I need the selected item in the combo after the record is loaded without the need of load thousands of records but found that this problem stills here.



    I just finished an application using DevExtreme in which this problem is *SOLVED*, dxSelect -the name of combobox in DevExtreme- calls "bykey" to retrieve the value to be shown).

    How a less evolved framework can have a better solution?

    Sad...
    UI: Sencha Architect / ExtJS 4 - 6
    Server side: JEE / EJB 3.x / CDI / JPA 2.x/ JAX-RS / JasperReports
    Application Server: WildFly / Weblogic
    Databases: Oracle
    / MySQL / DB2 / Firebird

    If you like my answer please vote!

  4. #34
    Ext JS Premium Member
    Join Date
    May 2008
    Location
    Austria, Vienna
    Posts
    264

    Default

    I coded a solution for this problem myself.
    If also sets some attributes to different default values which make more sense like not allowing items not included in the store (forceSelection: true).

    Improvements welcome!
    My last one was '&& !store.autoLoad' to enable the usage of one store for multiple naccomboboxes.

    Code:
    Ext.define('NAC.form.field.ComboBox', {
      extend: 'Ext.form.field.ComboBox',
      alias: 'widget.naccombobox',
    
    
      autoLoadOnValue: true,
      autoSelect: false,
      anyMatch: true,
      forceSelection: true,
      minChars: 3,
      typeAhead: true,
      // this adds an optimization to autoLoadOnValue by only loading the
      // record for the selected value
      setValue: function (value) {
        var store = this.getStore();
        if (!Ext6.isEmpty(value) && store !== null && !store.isEmptyStore && !store.isLoaded() && !store.autoLoad) {
          // console.log('load only selected record for ' + value + ' into store ' + store.getModel().getName());
          /* use the store
          * because it supports prefetching on the server side
          * which we need for the displayField
          */
          var idProperty = store.getModel().idProperty;
          store.addFilter({
            exactMatch: true,
            property: idProperty,
            value: value
          }, true);
          store.onAfter('load',
            function (eventName, args, options) {
              this.clearFilter(true);
            }, store, { single: true });
          this.callParent(arguments);
        } else {
          this.callParent(arguments);
        }
      }
    });

  5. #35
    Sencha Premium Member
    Join Date
    May 2010
    Location
    Guatemala, Central America
    Posts
    1,560

    Default

    Just about to implement something like yours but perhaps using the model.

    Thanks for the code!

    Regards!
    UI: Sencha Architect / ExtJS 4 - 6
    Server side: JEE / EJB 3.x / CDI / JPA 2.x/ JAX-RS / JasperReports
    Application Server: WildFly / Weblogic
    Databases: Oracle
    / MySQL / DB2 / Firebird

    If you like my answer please vote!

Page 4 of 4 FirstFirst ... 234

Similar Threads

  1. Combobox: setValue happens before store is loaded?
    By hallikpapa in forum Ext 3.x: Help & Discussion
    Replies: 11
    Last Post: 10 Jul 2016, 3:00 AM
  2. Combobox loaded remotely and scriptTagProxy question..
    By ImperioG in forum Ext 3.x: Help & Discussion
    Replies: 7
    Last Post: 12 Oct 2010, 11:51 PM
  3. Replies: 2
    Last Post: 8 Nov 2007, 8:27 AM

Posting Permissions

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