vendredi 4 juillet 2014

ExtJs 5: Problem with viewport in ASP.NET

We are in the process of migrating our ExtJs 4.2 webapplication to 5.0.

- IIS 7

- ASP.NET with Ajax

- ExtJs


There we noticed the following problem creating the viewport. Which certainly is not limited to this.


Error:


„Uncaught ReferenceError: format is not defined“

1.PNG


Callstack:

2.PNG


The problem only occurs in an ASP.Net Ajax environment. We have also identified the origin and have a solution.


Origin:


The new method getResponsiveState in our case provides rules = 0. This is correct since no responsiveConfig was set.

3.PNG


Unfortunately, a „number format []“ handler is defined in ASP.NET Ajax library:


4.PNG


This provides for our case:

5.PNG


Unfortunately, we did not know that such a thing is possible and we have been looking for hours. The solution for us was very simple. Perhaps this change can also be integrated directly into ExtJs 5:



Code:



getResponsiveState: function () {
var rules = this.getResponsiveConfig(),
stateArgs = Responsive.stateArgs,
ret = {},
entry, rule;


if(!rules) { return ret; }

for (rule in rules) {
entry = rules[rule];




if (!entry.fn) {
entry.fn = new Function(Responsive.argNames, 'return ' + rule);
}


if (entry.fn.apply(this, stateArgs)) {
Ext.merge(ret, entry.config);
}
}


return ret;
},




Aucun commentaire:

Enregistrer un commentaire