locked
0x800a138f - JavaScript runtime error: Unable to get value of the property 'offset': object is null or undefined RRS feed

  • Question

  • A weird error occurs in ui.js[dynamic], saying Unable to get value of the property 'offset': object is null or undefined in this function

    _groupFromOffset: function (offset) {
                this._updateOffsets();
                return offset < this._getGroup(0).offset ? 0 : this._site.groups.groupFromOffset(offset);
            },
    

     

    I was trying clear the list variable (WinJS.Binding.List();) in data.js file, once i got the data from service. If i don't do that, i'm not getting that error, So i'm doing something wrong in clearing the list. and repopulating. Here is the code snippet.

    var list = new WinJS.Binding.List();
    function getHomePageData() {
            list.forEach(function (item) {
                list.dataSource.remove(item.key);
            });
            
            return new WinJS.Promise(
            function (c, e, p) {
                WinJS.xhr({ url: "URl" }).then(
            function (req) {
                if (req.readyState == 4 && req.status == 200) {
                    var responseXML = req.responseXML.getElementsByTagName('HomePage');
                    for (var i = 0; i < responseXML.length; i++) {
                        try {
                            //list._currentKey = i;
                            list.push({
                                group: {
                                    key: keydata
                                    title: titledata
                                },
                            });
                        }
                        catch (exception) {
                        }
                    }
    
                    c({
                        results: list
                    });
                }
            },
            function (req) {
                e(req.status);
            },
            function (req) {
                p(req);
            });
            });
        }
    
    
    
    

    So basically what i'm trying to do is, every time it comes in i want to remove the existing and push the latest data.

    but its all working fine but when i navigate to next page and while coming back to landing page i'm getting that error!! Can some one help me in this?

     

    Friday, January 20, 2012 7:04 PM

Answers

All replies