Results 1 to 8 of 8

Thread: combo.store.load return an error (no blocking) only on IE

  1. #1
    Sencha Premium Member
    Join Date
    Nov 2011
    Location
    Compiegne FRANCE
    Posts
    48

    Default combo.store.load return an error (no blocking) only on IE

    Hello all,

    I have a little problem with cascaded combobox.
    On FireFox and on IE, the code is ok, I get all I want.
    But on IE (8), I have a little js error message when I click to expand (activate listeners that call combo.store.load).

    Error Message:

    Code:
    Message : Error Undefined.
    Line : 7
    Caractre : 8775
    Code : 0
    URI : http://10.128.238.23/library/ext-3.4.0/adapter/ext/ext-base.js
    This is my combobox(s) code:

    Code:
    // Combo list with existing value
    var comboExist    =    new Ext.form.ComboBox(
    {
        id                 :     this.id + sFieldName
        ,name              :     'NAME_' + sFieldName                
        ,fieldLabel        :     My.utils.translate('Select')
        ,xtype             :    'combo'
        ,store             :     My.utils.comboStore('NAME_'+sFieldName,"ProjectList", this.specsdef)
        ,mode              :     'local'
        ,displayField      :     'translation'
        ,valueField        :    'value'
        ,triggerAction     :    'all'
            
        // This option permit to load the value and display translation (nice)
         ,typeAhead        :    true
        ,lazyRender        :    true
        ,listeners         :    
        {
            render      :    function(combo, record, index){combo.store.load()}
            ,expand     :    function(combo){combo.store.load()} //
            ,select     :    function(combo, record, index){thisForm.reloadList(combo, record)}
            ,disable    :    function(){this.reset()}
        }
    });
    At the first time, when render is activate, the combo.store.load do not return error.
    After, when I click on expand, I get the good data but in gift I get the little error message !!! ;-)

    Did you have an explanation, or better, a solution to avoid this little error message ?

  2. #2
    Sencha User
    Join Date
    Jan 2011
    Posts
    549

    Default

    Whenever you get error messages only when using IE8 (and below), this is usually due to a trailing comma somewhere in your code. I would recommend checking if any of these exist amongst all code related to this action, since I don't immediately see any issues with the combo code you provided.

    Also consider removing your comments which are on separate lines inside the config (e.g. // This option permit...)
    , as I've also experienced issues with things like that before...

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

    Default

    Try running your code through JSlint:
    http://www.jslint.com/

    One think that may help if to get an editor that will perform a syntax check on your code. I like phpStorm.

    Regards,
    Scott.

  4. #4
    Sencha Premium Member
    Join Date
    Nov 2011
    Location
    Compiegne FRANCE
    Posts
    48

    Default

    Thank you both for your answer.

    I have checked trailing comma, but without success.
    I replace in my code:
    Code:
    ,expand        :    function(combo){combo.store.load()}
    by

    Code:
    ,expand        :    function(combo)
    {
               combo.reset();
    }
    --> No errors message,

    but If I add the combo.store.load()
    Code:
    ,expand        :    function(combo)
    {
           combo.reset();
           combo.store.load();
    }
    --> I get the error message ;-(

    Anybody have an idea?

  5. #5
    Sencha User
    Join Date
    Jan 2011
    Posts
    549

    Default

    In this situation I would use Firebug to console.log(combo), and console.log(combo.store) to ensure you're being returned the correct objects. I don't see any reason why you shouldn't be, but it would be the first thing I would do...

    If the combo.store var isn't being populated, try:
    Code:
    combo.getStore().load();

  6. #6
    Sencha Premium Member
    Join Date
    Nov 2011
    Location
    Compiegne FRANCE
    Posts
    48

    Default

    I did it, it's the correct object, I get the correct values in my combo (each time I clic to expand, I make a new request on my database, working fine).
    Just I get an error with IE, and it's not very clean ;-{.

  7. #7
    Sencha User
    Join Date
    Jan 2011
    Posts
    549

    Default

    In this case, I would go check your store code to ensure there are no trailing commas in that area.

    Since the error happens on store load, then the error must be originating thereabouts.

    I can't see this problem being anything other than a syntax issue which IE8 is very picky with. Using JSLint as Mitchell recommended would be a good way to test this against chunks of code.

  8. #8
    Sencha Premium Member
    Join Date
    Nov 2011
    Location
    Compiegne FRANCE
    Posts
    48

    Default

    My store is build dynamically for each combo box.
    This is the plugins:

    Code:
    (function(){
        My.utils = My.utils || {}; 
    
        My.utils.comboStore = function( sFieldName ,sFrom, sSpecsdef)
        {
            var autoLoad    =    false;    
            var fieldComboStore     =    new Ext.data.ArrayStore(
            {
                autoLoad    :    autoLoad
                ,fields        :    ['value', 'translation','tooltip']
                ,url        :    'common/getcombolistfromfield?ajax=1'
                ,baseParams :    {
                    fieldName         :    sFieldName
                    ,from             :    sFrom
                    ,specsdef         :     sSpecsdef
                }
            });
            return fieldComboStore; 
        };
    
    })();
    I have no error for other combobox.
    I have the error only when I call the store.load() with a listeners : 'expand'.

    For example, this is is my json for data store:

    Code:
    [["A","A - LEVEL1"],["B","B - LEVEL2"],["C","C - LEVEL3"],["D","D - DESIGN STUDY"],["E","E - VERSION RETRO"],["F","F - VERSION DDP ACOUSTIQUE"]]
    Thank you for your help.

Posting Permissions

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