对象不支持 igGrid 中的属性或方法“_super”

Object doesn't support property or method "_super" in igGrid

本文关键字:方法 super 属性 不支持 igGrid 对象      更新时间:2023-09-26

我在应用程序中使用了infragistics igGrid,但出现javascript错误

对象不支持属性或方法"_super"

我知道这是可以避免的,但出于某些原因,我想给它假实现(或真正的答案,可能会添加一些缺失的参考)。我尝试跟随但没有工作。

var _super = function(a,s,d,f,g,h) {
}

在引用igGrid JS 库之前,我已经编写了上面的代码。

在代码中,_super 在调用它时具有可变数量的参数。

你可能引用的jQuery UI版本仍然没有_super_superApply实现。尝试引用最新版本,错误应该会消失。

https://bugs.jqueryui.com/ticket/6861

如果我理解正确,您正在尝试使用超出范围的_super。您可以在对象作用域中使用_super,如下所示:

(function ($) {
    $.ig.RPCDataSource = $.ig.RPCDataSource || $.ig.RESTDataSource.extend({
    _processJsonResponse: function (data, context) {
            try {
               console.log('my special preprocessing');
               return this._super(data, context);
            } catch (e) {
                console.log(e.message);
                // my special error handling
            } 
        },
   });
}(jQuery));

更新 _super 是来自 jQuery widget 工厂的方法。iG 控件基于 jQuery Widget 构建。因此_super是在jQuery小部件中定义的。