1. #121
    Sencha User Stormseeker's Avatar
    Join Date
    Jan 2010
    Location
    Evanston, Illinois
    Posts
    55
    Vote Rating
    1
    Stormseeker is on a distinguished road

      0  

    Default Component.js -> getRefItems question.

    Component.js -> getRefItems question.


    I have eclipse setup to run all code in my project through JSHint and I noticed a warning about this below code (Expected a conditional expression and instead saw an assignment) and was trying to figure out the meaning.

    Code:
                if (item = Ext.getCmp(ids[index])) {
                    items.push(item);
    
    
                    if (deep && item.getRefItems) {
                        items.push.apply(items, item.getRefItems(true));
                    }
                }
    For the first if statement, are you just trying to check if the item object exists after you try and retrieve it from Ext.getCmp... I.E. would it be equal to this?

    Code:
    item = Ext.getCmp(ids[index]);
    if (item)
    {
        items.push(item);
        if (deep && item.getRefItems)
        {
            items.push.apply(items, item.getRefItems(true));
        }
    }

  2. #122
    Sencha User skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,101
    Vote Rating
    120
    skirtle is a splendid one to behold skirtle is a splendid one to behold skirtle is a splendid one to behold skirtle is a splendid one to behold skirtle is a splendid one to behold skirtle is a splendid one to behold skirtle is a splendid one to behold

      0  

    Default


    Yes.