PDA

View Full Version : [OPEN] Missed (?) dependency reference to a Ext.util.Point in Ext.EventObjectImpl



zerkms
23 Apr 2013, 6:28 PM
Version 4.2.0

Steps to reproduce:

1. Modify shared/include-ext.js to load -debug version:


document.write('<script type="text/javascript" src="' + path + '/ext-debug' + (rtl ? '-rtl' : '') + '.js"></script>');

2. Open /grid/binding.html?theme=classic
3. Click on any column header

Expected result: click should be handled properly
Actual result: the exception is thrown since the Ext.util.Point isn't loaded



getPoint : function(){
var xy = this.getXY();
return new Ext.util.Point(xy[0], xy[1]);
},

slemmon
23 Apr 2013, 10:23 PM
ext-debug.js loads most classes - core classes, but not all classes and would require the loader to be set up to import some of the classes like Point. Looks like that example doesn't have the loader configured.

zerkms
24 Apr 2013, 2:48 PM
ext-debug.js loads most classes - core classes, but not all classes and would require the loader to be set up to import some of the classes like Point. Looks like that example doesn't have the loader configured.

Yep, and the trivial fix would be to replace `uses` to `requires` in the declaration

zerkms
25 Apr 2013, 12:46 PM
ext-debug.js loads most classes - core classes, but not all classes and would require the loader to be set up to import some of the classes like Point. Looks like that example doesn't have the loader configured.
Oh I see what you mean - but Ext.Loader cannot handle `new Ext.util.Point`. By definition.

Ext.Loader could handle it if we used `Ext.Create()` not `new`

slemmon
26 Apr 2013, 11:54 AM
You might try with ext-dev.js when working on a dev build. You should get prompts when a required class is loaded synchronously and needs a requires.

zerkms
26 Apr 2013, 1:35 PM
You might try with ext-dev.js when working on a dev build. You should get prompts when a required class is loaded synchronously and needs a requires.

It won't work, because:
1. There is no `requires`, it's missed, as I said
2. It's `new` used not `Ext.create`. And `new` cannot be handled

Just to summarize, the facts:

1. ext-debug.js is broken at the moment, you can check it easily - just open any grid demo with ext-debug.js loaded and click on header. I added steps to reproduce intentionally, please try it before you reply next time - otherwise we're wasting our time :-(
2. Loader **CANNOT** autoload classes instantiated with `new`

ovidiupruteanu
26 May 2013, 12:38 PM
I can confirm this.

Either the definition of Ext.util.Point should be included in ext-debug.js or
Ext.create('Ext.util.Point', xy[0], xy[1]) should be used instead of
new Ext.util.Point(xy[0], xy[1]) in the getPoint function of Ext.EventObjectImpl

LesJ
26 May 2013, 2:03 PM
I also confirm this defect. I have a chart that generates an error on mouseover. If I require 'Ext.util.Point', the error disappears. I use Ext JS 4.2 and Sencha Cmd to build the application.

If it's necessary, I can provide a complete example demonstrating this error.


Ext.define('PivotGrid.view.chart.Measure', {
extend: 'Ext.chart.Chart',
requires: [
'Ext.chart.series.Column',
'Ext.chart.axis.Numeric',
'Ext.chart.axis.Category',
'Ext.util.Format',
'Ext.util.Point', // <--- This should not be requirred
'PivotGrid.store.chart.Measure'
....
],

evant
29 May 2013, 7:34 PM
I can't reproduce this using the test case in the OP, using .663 or the latest 4.2.1 build.

zerkms
29 May 2013, 7:48 PM
It's still perfectly reproducible following the original post instructions for ext-4.2.1.883

There is still `return new Ext.util.Point(xy[0], xy[1]);` line in the ext-debug.js and no one loads Ext.util.Point class.

Make sure you have your js console opened while reproducing.

evant
29 May 2013, 7:56 PM
Maybe I'm missing something then:

http://screencast.com/t/o6dgtHmPYJjI

I changed the include to grab the debug as you suggested. I load up the example. There's no exceptions. Using a clean 883 download.

zerkms
29 May 2013, 8:04 PM
Are you sure the ext-debug version was loaded? It's not possible that it works for you.

zerkms
29 May 2013, 8:13 PM
http://screencast.com/t/nk6XTpkw - here is a video with an exception

ovidiupruteanu
30 May 2013, 7:46 AM
Here is some sample code to reproduce the issue. I have tested on 4.2.1.883
You can see the error when you try reordering the nodes in the tree.


<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<link rel="stylesheet" type="text/css" href="../../resources/ext-theme-classic/ext-theme-classic-all-debug.css" />
<script type="text/javascript" src="../../ext-debug.js"></script>


<script type="text/javascript">


Ext.require('Ext.tree.*');
Ext.require('Ext.data.*');


Ext.onReady(function(){

Ext.create('Ext.tree.Panel', {
height: 400,
width: 350,
renderTo:'tree',
store: new Ext.data.TreeStore({
root: {
expanded: true,
text: "My Root",
children: [
{ text: "Child 1", leaf: true },
{ text: "Child 2", expanded: true, children: [
{ text: "GrandChild", leaf: true }
] }
]
}
}),
viewConfig: {
plugins: {
ptype: 'treeviewdragdrop'
}
}
});
});


</script>

</head>
<body>
<div id="tree"></div>
</body>
</html>

Uncaught TypeError: undefined is not a function ext-debug.js:12187
Ext.define.getPoint ext-debug.js:12187
Ext.define.handleMouseDown DragDrop.js:812
Base.implement.callParent ext-debug.js:4266
Ext.define.handleMouseDown DragSource.js:343
Ext.define.onItemMouseDown DragZone.js:89
fire ext-debug.js:9818
continueFireEvent ext-debug.js:11210
fireEventArgs ext-debug.js:11188
fireEvent ext-debug.js:11174
Ext.define.processUIEvent View.js:582
Base.implement.callParent ext-debug.js:4266
Ext.define.processUIEvent View.js:258
Ext.define.handleEvent View.js:509
(anonymous function)
wrap ext-debug.js:10566

evant
30 May 2013, 2:14 PM
Looks like I was getting a weird caching issue. As it goes, when the ext-debug file gets built it strips out the dependency loading which is incorrect. So it's not really a framework bug, but one in Cmd. Anyway, we'll look into it, sorry for the confusion.

mschwartz
5 Jun 2013, 6:35 AM
I ran into this today.

A fix, since nobody's really posted one (I think) is:


requires: [
...
'Ext.util.Point'
]


I don't get the exception with that in my code.

LesJ
5 Jun 2013, 6:39 AM
I ran into this today.

A fix, since nobody's really posted one (I think) is:


requires: [
...
'Ext.util.Point'
]


I don't get the exception with that in my code.

Already posted by zerkms: ;)

"Yep, and the trivial fix would be to replace `uses` to `requires` in the declaration"

mschwartz
5 Jun 2013, 6:42 AM
Actually the fix was in your own post, not his. He explained the issue, but didn't present any solution as code that might help people resolve it.

Thanks to the forums for helping resolve these kinds of things when they (rarely) arise!

LesJ
5 Jun 2013, 6:55 AM
I believe the difference between uses and requires is only in development since in production all code is already loaded. So making this change should have no impact on production code.

hschaefer123
2 Oct 2013, 3:27 AM
Any news on this?

The bug is still represent in

ext-4.2.2.1162

I am using Sencha Architect and the workaround using
requires Ext.util.Point
fixes it, but that should not be the final solution ;-)

Cheers Holger

LesJ
2 Oct 2013, 11:15 AM
Heh... this is the first item I checked. Let's hope it will be fixed in 4.2.3.

Ding-Jun
29 Dec 2013, 9:15 PM
We met the same issue when using the extjs v4.2.2, the getPoint function is using 'new' instead of Ext.create to instantiate an instance which makes ext loader cannot load the required Ext.util.Point class. This issue occurs when user moves mouse on a bar chart.