【问题标题】:Ext JS 4: JavaScript Exception "TypeError: Ext.resetElement is undefined" in Ext JS version 4.1.1Ext JS 4:Ext JS 版本 4.1.1 中的 JavaScript 异常“TypeError:Ext.resetElement 未定义”
【发布时间】:2012-09-07 01:37:28
【问题描述】:

Ext JS 4.1.1 破坏了我使用 ASP.NET 设置的代理。我不得不切换回 4.1.0 版本来解决这个问题。只是想我会把这个问题扔在那里,直到它被 Sencha 解决。

JavaScript 异常:

"TypeError: Ext.resetElement is undefined" ==> "...s.styleProxyEl || (Ext.AbstractComponent.prototype.styleProxyEl" ==> ext-all-debug.js (line 26960)

getStyleProxy: function(cls) {

    var result = this.styleProxyEl || (Ext.AbstractComponent.prototype.styleProxyEl = Ext.resetElement.createChild({
        style: {
            position: 'absolute',
            top: '-10000px'
        }
    }, null, true));

    result.className = cls;
    return result;
}, 

解决方法:

下载 ExtJS 框架的 4.1.0 版本,而不是使用 4.1.1 版本。

http://cdn.sencha.io/ext-4.1.0-gpl.zip

如果有人能准确解释这里的问题,我会将他们的答案标记为正确。这是我正在使用的代理。

Ext.define('Ext.ux.AspWebAjaxProxy', {
    extend: 'Ext.data.proxy.Ajax',
    require: 'Ext.data',

    buildRequest: function (operation) {
        var params = Ext.applyIf(operation.params || {}, this.extraParams || {}),
                                request;
        params = Ext.applyIf(params, this.getParams(params, operation));
        if (operation.id && !params.id) {
            params.id = operation.id;
        }

        params = Ext.JSON.encode(params);

        request = Ext.create('Ext.data.Request', {
            params: params,
            action: operation.action,
            records: operation.records,
            operation: operation,
            url: operation.url
        });
        request.url = this.buildUrl(request);
        operation.request = request;
        return request;
    }
});

【问题讨论】:

  • broke my proxies I had set up with ASP.NET 到底是什么意思
  • @sra - 在问题中粘贴了我的代理类
  • 据我所知,当 Ext.util.Renderable mixin 渲染某些内容时抛出了错误,我在您的代理中看不到任何内容。你看过调用栈了吗?
  • 我是 JavaScript 编程的新手,但这个 ExtJS 框架开始在我身上成长。你能告诉我在哪里可以找到吗?
  • 您似乎将 firefox 与 firebug 一起使用。如果您可以在那里找到堆栈跟踪,我不太确定...我建议您将 chrome 与活跃的开发人员工具一起使用。这些会给你一个堆栈跟踪

标签: asp.net proxy extjs


【解决方案1】:

确保您使用的是Ext.onReady(function() { ... })。 ExtJS 使用Ext.resetElement,它是在onReady 调用之前设置的。

【讨论】:

    【解决方案2】:

    另一个对我有用的解决方法是在使用 ext 对象之前定义这个元素:

    Ext.resetElement = Ext.getBody();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-26
      相关资源
      最近更新 更多