0

我没有看到错误在哪里。我在同一页面的另一部分有类似的代码,具有类似的设置,在 IE 中运行良好,但这会引发错误。我最初尝试只推送每个值,但 IE 有问题(请参阅http://www.knockmeout.net/2012/04/knockoutjs-performance-gotcha.html)。

function DocSubType( doc_subtype_id, description ) {
    this.doc_subtype_id = ko.observable( doc_subtype_id );
    this.description = ko.observable( description );
};  
....
docsubtypeModel = [ ], //Where the loaded descriptions are stored. Knockout observers this.

viewDocSubTypeModel = {
    docsubtypes: ko.observableArray(docsubtypeModel),
....
download: function() {
    $.getJSON( DocSubTypesettings.list, function( json ) {
        //Push to the original model and then stated that it has mutated to speed up performance in IE.
        var tmparray = viewDocSubTypeModel.docsubtypes();
        for( i=0; i < json.docsubtypes.length; i++ ) {
            tmp = new DocSubType( json.docsubtypes[i].doc_subtype_id, json.docsubtypes[i].description );
            tmparray.push( tmp );
        }
        viewDocSubTypeModel.docsubtypes.valueHasMutated(); /*ERROR HERE*/        
    });
}

IE8 报告“JScript Object expected” knockout-1.2.1.js,第 34 行字符 262。(或 knockout-1.2.1.debug.js,第 928 行字符 19)

4

1 回答 1

0

问题是我写了一个导致评估失败的排序助手。

于 2012-10-05T15:50:12.550 回答