View Full Version : [SOLVED] TreeNode checkchange IE7
mandad
26 Jul 2007, 2:45 PM
In IE7, the checkchange event of TreeNodes with checkboxes are not properly firing correctly. The function attached to the event is just doing a test callback under ASP.net for now and it only seems to be triggered upon arbitrary changes of the checkboxes. Also, when the event is triggered the check state is lost (i.e. the box was unchecked and remains so afterward). The events appear to be triggering correctly in Firefox.
I am adding the event to the tree itself like this:
theTree.on('checkchange', TaskResult.NodeChecked);
Edit:
Upon further investigation, the behavior I am able to reproduce is that once the checkbox is clicked, I have to click again to get it to fire the event. I can click anywhere on the page except again on the same checkbox. If I do click on the same one and then somewhere else, no event is ever fired until the state of the checkbox is different than its original.
Using:
Ext 1.1 RC1
Windows XP
Internet Explorer 7.0.5730.11
ext-all-debug.js / ext-yui-adapter.js / yui-utilities.js
Damian Manda
mystix
26 Jul 2007, 6:31 PM
please refer to http://extjs.com/forum/showthread.php?t=8887
aconran
2 Aug 2007, 8:57 AM
I am also experiencing the same issue as posted above with Ext 1.1 stable.
[Standard info]
1. Ext version + build no. 1.1Stable
2. ext-base.js
3. windows(xp)
4. browser IE + build no. 7.0.5730.11
Here is some code demonstrating the problem... a modification of reorder.js in the examples.
function captureEvents(observable) {
Ext.util.Observable.capture(observable, function(eventName) {console.log(eventName);}, this);
}
Ext.onReady(function(){
// shorthand
var Tree = Ext.tree;
var tree = new Tree.TreePanel('tree-div', {
animate:true,
loader: new Tree.TreeLoader({
dataUrl:'get-nodes.php',
baseAttrs: {checked: false}
}),
enableDD:true,
containerScroll: true
});
// set the root node
var root = new Tree.AsyncTreeNode({
text: 'Ext JS',
draggable:false,
id:'source'
});
tree.setRootNode(root);
// render the tree
tree.render();
root.expand();
captureEvents(tree);
});
In addition, ext-all.js must be changed to ext-all-debug.js to use the console in IE.
You will note that the checkchange event is sparodic in IE but consistent in FF.
aconran
2 Aug 2007, 11:49 AM
The Ext 1.1 standard also works in Opera 9.22.
I made the following change in initEvents of TreeNodeUI
if(this.checkbox){
var en = Ext.isIE ? 'click' : 'change';
Ext.EventManager.on(this.checkbox, en, this.onCheckChange, this);
}
I've tested this in Opera, FF and IE 7+ and it seems to work as expected.
Aaron
mandad
7 Aug 2007, 10:02 AM
Finally got around to testing the fix and it works under my usage as well. Marking thread as solved.
how i can change initEvents of TreeNodeUI ?
sample pls
i understand.....
i must modify ext-all.js
right ?
aconran
26 Aug 2007, 5:52 PM
I typically create a file called overrides.js and place it in my "ext/" directory with all of my overrides.
Then apply over the prototype of Ext.tree.TreeNodeUI's implementation.
Ext.apply(Ext.tree.TreeNodeUI.prototype, {
// solves cross browser issue for IE as described here:
// http://extjs.com/forum/showthread.php?t=10027
initEvents : function(){
this.node.on("move", this.onMove, this);
var E = Ext.EventManager;
var a = this.anchor;
var el = Ext.fly(a, '_treeui');
if(Ext.isOpera){ // opera render bug ignores the CSS
el.setStyle("text-decoration", "none");
}
el.on("click", this.onClick, this);
el.on("dblclick", this.onDblClick, this);
if(this.checkbox){
var en = Ext.isIE ? 'click' : 'change';
Ext.EventManager.on(this.checkbox, en, this.onCheckChange, this);
}
el.on("contextmenu", this.onContextMenu, this);
var icon = Ext.fly(this.iconNode);
icon.on("click", this.onClick, this);
icon.on("dblclick", this.onDblClick, this);
icon.on("contextmenu", this.onContextMenu, this);
E.on(this.ecNode, "click", this.ecClick, this, true);
if(this.node.disabled){
this.addClass("x-tree-node-disabled");
}
if(this.node.hidden){
this.addClass("x-tree-node-disabled");
}
var ot = this.node.getOwnerTree();
var dd = ot.enableDD || ot.enableDrag || ot.enableDrop;
if(dd && (!this.node.isRoot || ot.rootVisible)){
Ext.dd.Registry.register(this.elNode, {
node: this.node,
handles: this.getDDHandles(),
isHandle: false
});
}
}
});
Make sure that this comes after including ext-all.js.
Aaron
becomcs
8 Apr 2008, 4:02 AM
It works great! After two days, I was afraid to not beeing able to deliver a release for friday.
Thanks a lot!
CNash44
29 Jul 2008, 12:38 PM
I am experiencing the same problem, but with an AsyncTreeNode.
Is there a similar fix for that class?
Thanks.
aconran
29 Jul 2008, 12:50 PM
Since this was a change done in TreeNodeUI it should affect the AsyncTreeNode as well. What version of Ext are you running?
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.