PDA

View Full Version : ExtJS 4.0.2 to ExtJS 4.1.1



mixo
26 Jul 2012, 7:55 PM
Hello guys!
First of all glad to see that ExtJS project successfully develops. My current project works on ExtJS 4.0.2 and now I want to try to use latest ExtJS4.1.1. I've included all libraries and components and try to start it on 'ext-all-debug.js' but I have some errors here. Code works on 4.0.2 and fail on 4.1.1. This applies to ajax-requests and especially Ext.Ajax.request. It seems to me that Ext.Ajax.request callbacks no more have access to local vars on scope from which i try to do ajax-request

Some code(works on Ext 4.0.2):


function if_active(args){
var fn = args.fn;
var params = args.params;
var config = args.config;
Ext.Ajax.request({
url:'/is_active/',
success: function(response){
res = Ext.JSON.decode(response.responseText);
if(res.success){
if(fn){
fn(params); <--- error here
}
if(config){
Ext.Ajax.request(config);
}
}
}
});
}

Uncaught TypeError: Cannot read property 'fn' of undefined ext-all-debug.js:25038



addManagedListener : function(item, ename, fn, scope, options) {

var me = this,
managedListeners = me.managedListeners = me.managedListeners || [],
config;



if (typeof ename !== 'string') {
options = ename;
for (ename in options) {
if (options.hasOwnProperty(ename)) {
config = options[ename];
if (!me.eventOptionsRe.test(ename)) {
me.addManagedListener(item, ename, config.fn || config, config.scope || options.scope, config.fn ? config : options);http://www.sencha.com/forum/chrome-devtools://devtools/Images/errorIcon.png
Uncaught TypeError: Cannot read property 'fn' of undefined

}
}
}
}
else {
managedListeners.push({ item: item, ename: ename, fn: fn, scope: scope, options: options });
item.on(ename, fn, scope, options); }
},



Help please. I want more features, I want to use ExtJS 4.1.1!!! \:D/

scottmartin
2 Aug 2012, 9:52 PM
Without knowing the extent of args, it would be hard to tell. Please verify your argument passed is what is expected.

Scott.

mixo
5 Aug 2012, 7:14 PM
Thanks for answer, Scott.

Call of this function is absolutely correct, because it's just copy\pasted from my project which works on ExtJs 4.0.2. And therefore it's accept the same arguments.
It's good to understand what is fundamentally changed in version 4.1.1 from version 4.0.7 or early.

evant
5 Aug 2012, 7:33 PM
The error obviously isn't where you say it is, because the stack trace says it's trying to add a managed listener somewhere. As Scott said, there isn't enough information.

mixo
7 Aug 2012, 1:32 AM
Hmm..

evant, actually I agree with you, that addListener is absolutely differ with action I tried to do.
Well, looks like better I try to find some more information.

Thanks guys.

nosferatum
7 Aug 2012, 5:31 AM
The page with Ext.Ajax.request stopped working after switching from Ext 4.1 to 4.1.1.
Reason is that 'success' handlers response argument has 'undefined' responseText.



Ext.Ajax.request({
isUpload: true
, form: Ext.get(formId).dom

, url: '127.0.0.1:8080' + '/serviceGenerator/loadTemplates'

, success: function(response) {
var result = Ext.decode(response.responseText); // crashes because response.responseText is undefined
}
});


it has to be mentioned, that this particular request uses 'isUpload: true' for uploading files in form.
I'm not sure whether same problem appears with simple Ext.Ajax.request.

Server response (wathced from Firebug's Net tab) is:



{"filePath":"D:\\java\\rpgu\\branches\\crosscontext\\jboss\\server\\default\\generator\\123456_all_validations_92_xlsx.zip","success":true}



Update
Some crazy thing is: when response's JSON contains "success": false, responseText is filled correctly.

nosferatum
7 Aug 2012, 6:13 AM
The problem is that in my "success: true" server branch I didn't set contentType to "text/html".

I'd really appreciate if this requirement would be added to Ext.Ajax documentation and FAQ.

mixo
14 Aug 2012, 6:43 PM
After debugging I find seat of the trouble



var maindataview = Ext.create('Ext.view.View', {});

TypeError: Cannot read property 'fn' of undefined


simply execute this row in browser console rise error, and my project use dataView's.

then I try execute the same code on ext 4.0.2 it successfully works.

nosferatum
14 Aug 2012, 11:33 PM
Please check whether Ext.Loader is enabled. According to ext 4 docs, It defaults to false, and Ext.create works only if Ext.Loader is enabled.

mixo
15 Aug 2012, 12:14 AM
Please check wheter Ext.Loader is enabled. According to ext 4 docs, It defaults to false, and Ext.create works only if Ext.Loader is enabled.

my code starts with

Ext.Loader.setConfig({enabled: true});
and code


var textfield = Ext.create('Ext.form.field.Text', {});
works correctly on ext 4.1.1, that also proves that Ext.Loader is enabled.

can any body just execute in your browser console


var maindataview = Ext.create('Ext.view.View', {});

nosferatum
15 Aug 2012, 12:57 AM
I suppose you should provide required options to config since you're creating Ext.view.View directly.

If you look at Ext.view.View api docs, these required options are: itemSelector, store and tpl.

mixo
15 Aug 2012, 1:10 AM
I suppose you should provide required options to config since you're creating Ext.view.View directly.

If you look at Ext.view.View api docs, these required options are: itemSelector, store and tpl.

you are absolutely right about that, and i have this options. but there is no difference if I try to create DataView with params.


var maindataview = Ext.create('Ext.view.View', {
border: false,
store: store,
parent: this,

tpl : new Ext.XTemplate(
'<tpl for=".">',
'<tpl if="xindex%this.col_length==1">',
'<tpl if="xindex &gt; 1">',
'</ul>',
'</tpl>',
'<ul class="app_list">',//t="{#}" d="{[xindex%5==1]}" b="{[this.view_height]}"
'</tpl>',
'<li class="app" id="{name}.icon" data-qtip="{title}">',
(!Ext.isIE6? '<img width="48" height="48" src="/static/img/cluster/{name}.png" />' :
'<div style="width:48px;height:48px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'/static/img/cluster/{name}.png\',sizingMethod=\'scale\')"></div>'),
'<strong handle = {name}>{title}</strong>',
'<tpl if="xindex==xcount">',
'</ul>',
'</tpl>',
'</tpl>',
{
view_height:700,
col_length:5,
get_col_len: function(){
return 5;
}
}
),

id: 'apps',

itemSelector: '.app',
overItemCls : 'cluster-hover',
multiSelect : false,
layout: 'fit',
});

mixo
15 Aug 2012, 6:31 PM
I continue search for solution of my problem and found this thing.

Sencha doc server for 4.1 version use ExtJs 4.1.0rc as we can see by typing


Ext.versions

exec my test row there looks like this


v = Ext.create('Ext.view.View',{})

DataView requires both tpl and itemSelector configurations to be defined.



then i pass needed params it create dataview


v = Ext.create('Ext.view.View',{tpl:'ttt', itemSelector:'.aps'})

h <- created component sign



but in download section I get ExtJs 4.1.1 which I can see also by


Ext.versions

and there my samples executed by this


v = Ext.create('Ext.view.View',{})

TypeError: Cannot read property 'fn' of undefined

v = Ext.create('Ext.view.View',{tpl:'ttt', itemSelector:'.aps'})

TypeError: Cannot read property 'fn' of undefined



I guess this problem shows only in ExtJS 4.1.1. And I can't find ExtJs 4.1.0rc for download. Is it available now?
Updated:
url for getting Ext 4.1.0 (http://cdn.sencha.io/ext-4.1.0-gpl.zip)

mixo
15 Aug 2012, 9:29 PM
well I solve the issue!

it turns out that some patches are not needed any more for Ext 4.1.
as for me there is a patch for Ext.view.AbstractView - bindStore function

Now I fill better. Thanks