Results 1 to 2 of 2

Thread: [BUG]. combobox load store on setValue()

  1. #1
    Ext JS Premium Member
    Join Date
    May 2008
    Posts
    61
    Answers
    3
    Vote Rating
    1
      0  

    Default [BUG]. combobox load store on setValue()

    Hi Sencha,
    I have the following issue:
    I have a combobox.
    The combobox has a remote store
    combobox.setValue(<id>) is called.
    To display proper displayField the combobox needs to load the model record for the set <id> .
    ExtJs code loads the store for the combobox, if it has not been loaded.
    If a record in the store matches the <id>, then it is used as a value, and the correct displayField is shown.

    The problem is that the store can be paginated. If the <id> is not in the first page, then the record is not loaded, and displayField is not shown in the combobox.

    This is not proper.
    This is basic functionality.
    Please fix it.

    The combobox should call store.model.load(<id>) and use that record to display selected field.

  2. #2
    Sencha User
    Join Date
    Jul 2017
    Posts
    40
    Answers
    5
    Vote Rating
    5
      0  

    Default

    Is this problem similar to what you're experiencing? If so a simple override will fix it,
    Code:
    Ext.override(Ext.form.field.ComboBox,{
        findRecord:function(field, value){
            var foundRec =null;
            Ext.each(this.lastSelection,function(rec){
                if(rec.get(field)=== value){
                    foundRec = rec;
                    returnfalse;// stop 'each' loop
                }
            });
            if(foundRec){
                return foundRec;
            }else{
                returnthis.callParent(arguments);
            }
        }
    });
    



  3. #3
    Sencha User
    Join Date
    Jul 2017
    Posts
    40
    Answers
    5
    Vote Rating
    5
      0  

    Default

    Is this problem similar to what you're experiencing? If so it's a pretty simple override to fix:
    Code:
    Ext.override(Ext.form.field.ComboBox,{
        findRecord: function(field, value) {
            var foundRec = null;
            Ext.each(this.lastSelection, function(rec) {
                if (rec.get(field) === value) {
                    foundRec = rec;
                    return false; // stop 'each' loop
                }
            });
            if (foundRec) {
                return foundRec;
            } else {
                return this.callParent(arguments);
            }
        }
    });

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 setValue and loaded store
    By d.zucconi in forum Ext 5: Q&A
    Replies: 0
    Last Post: 19 Nov 2015, 3:19 AM
  3. Field setValue before store.load()
    By Nikkelmann in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 16 Aug 2011, 10:22 PM
  4. [SOLVED] ComboBox SetValue from FormPanel Load
    By maquejp in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 1 Jul 2008, 3:04 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
  •