1. #1
    Ext User nidkil's Avatar
    Join Date
    Sep 2008
    Posts
    30
    Vote Rating
    0
    nidkil is on a distinguished road

      0  

    Default Ext.menu.Menu.items.get(i) not working in IE

    Ext.menu.Menu.items.get(i) not working in IE


    Hi,

    I am using the following code to iterate through checked menu items to turn columns in a grid on and off. It works perfectly in IE, but it does not work in IE (problem line marked with <---------). Any ideas what the problem is?

    var zoomMenu = new Ext.menu.Menu({
    id:'zoomMenu',
    width:150,
    items: [
    {id:'2007', text:'2007', checked:false, checkHandler: onItemCheck, scope:this},
    {id:'2008', text:'2008', checked:true, checkHandler: onItemCheck, scope:this},
    {id:'2009', text:'2009', checked:false, checkHandler: onItemCheck, scope:this},
    "-",
    {id:'jaren', text:'Alleen jaarkolommen', checked:false, checkHandler: onItemCheck, scope:this}
    ]
    });

    function setZoomMenuText() {
    var btnText = "Zoom: ";
    var items = zoomMenu.items;
    var cnt = items.getCount();
    for(var i = 0; i < items.length; i++){
    item = items.get(i); // <---------
    if(!Ext.isIE) console.log("i=" + i + ", item=" + item);
    if(item.checked == true) btnText += " " + item.text;
    showHideColumns(item.text, (item.checked ? false : true));
    }
    return btnText;
    };

    Regards, nidkil

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,499
    Vote Rating
    47
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    When you say it's not working, how do you know that that line of code is being executed?

    What is "items.length" when you STEP THROUGH YOUR CODE IN A DEBUGGER hm?

  3. #3
    Ext User nidkil's Avatar
    Join Date
    Sep 2008
    Posts
    30
    Vote Rating
    0
    nidkil is on a distinguished road

      0  

    Default


    Impress reaction time!

    IE gives an error message and asks if I want to debug the code. The error is caused by the line I marked. It says that the object does not support the get method. The same code works fine in Firefox.

    Ps. the length = 0 !?!?!? but cnt = 5

  4. #4
    Ext User nidkil's Avatar
    Join Date
    Sep 2008
    Posts
    30
    Vote Rating
    0
    nidkil is on a distinguished road

      0  

    Default


    Hi animal,

    I changed the code to this, and even though len does get the value 5 it still fails when using itemAt to get the menu item ... Any ideas?

    function setZoomMenuText() {
    var btnText = "Zoom: ";
    for(var i = 0, len = zoomMenu.items.length; i < len; i++){
    item = zoomMenu.items.itemAt(i);
    if(!Ext.isIE) console.log("i=" + i + ", item=" + item);
    if(item.checked == true) btnText += " " + item.text;
    showHideColumns(item.text, (item.checked ? false : true));
    }
    return btnText;
    };

  5. #5
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    86
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Why would you assume that items.length returns anything?

    items is a MixedCollection, which doesn't have a length property.

  6. #6
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,499
    Vote Rating
    47
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    WHy are you using IE??????????

    If you are a developer with need to debug your code (because we all write buggy code!), then you should develop using Firefox and Firebug.

  7. #7
    Ext User nidkil's Avatar
    Join Date
    Sep 2008
    Posts
    30
    Vote Rating
    0
    nidkil is on a distinguished road

      0  

    Default


    Hi animal,

    I just reread my first mail and see I did not describe my problem correctly: the code DOES work in Firefox, but does NOT work in IE. Hope this info helps to find the problem.

    Regards, nidkil

  8. #8
    Ext User nidkil's Avatar
    Join Date
    Sep 2008
    Posts
    30
    Vote Rating
    0
    nidkil is on a distinguished road

      0  

    Default


    Hi guys,

    After browsing the forum I decided to change my code to use each and this did the trick. For anyone interested, this is the new code:

    function setZoomMenuText() {
    var btnText = "Zoom: ";

    zoomMenu.items.each(function(item){
    if(item.checked == true) btnText += " " + item.text;
    showHideColumns(item.text, (item.checked ? false : true));
    });

    return btnText;
    };

    Regards, nidkil

Thread Participants: 2

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi