Ext JS 4: JavaScript Exception “TypeError: Ext.res

2019-07-04 15:29发布

Ext JS 4.1.1 broke my proxies I had set up with ASP.NET. I had to switch back to version 4.1.0 to resolve the issue. Just thought I'd throw this issue out there until it's resolved by Sencha.

JavaScript Exception:

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

enter image description here

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;
}, 

Workaround:

Download version 4.1.0 of the ExtJS framework instead of using version 4.1.1.

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

If someone can explain what broke here exactly, I'll mark their answer as correct. Here is the proxy I'm using.

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;
    }
});

2条回答
Explosion°爆炸
2楼-- · 2019-07-04 16:26

Make sure you are using Ext.onReady(function() { ... }). ExtJS uses Ext.resetElement which is set before onReady call.

查看更多
甜甜的少女心
3楼-- · 2019-07-04 16:31

Another workaround that works for me is to define this element before using ext objects:

Ext.resetElement = Ext.getBody();
查看更多
登录 后发表回答