PDA

View Full Version : Treepanel scrollbar going up when I checked any item.



aniketpatil014
29 Jun 2015, 7:44 AM
Hi Team,

I have an issue with Treepanel checkbox selection. After scrolling when I click on any item the Treepanel is going up. i.e. Tree panel will show nodes from first node again.

Below is the code :
xtype:'treepanel',
width: 1065,
maxHeight: 360,
margin : '15 0 0 17',
store:'AppServiceTreeStore',
rootVisible: false,
columnLines : true,
useArrows : true,
rowLines : true,
singleExpand: true

tristan.lee
29 Jun 2015, 8:02 AM
What version of Ext 4 are you using? Can you create a fiddle (https://fiddle.sencha.com) to demonstrate the issue?

aniketpatil014
29 Jun 2015, 8:14 AM
I am using EXTJS 4.2. Also I would like to mention that I am using different treecolumn in one treepanel. I will not able to create JS fiddle because of security reason.

Here below is my full configuration.

{ xtype:'treepanel',
//id: 'sub-Functionalities-tree',
cls : 'nwm-Grid',
width: 1065,
maxHeight: 360,
margin : '15 0 0 17',
store:'AppServiceTreeStore',
rootVisible: false,
columnLines : true,
useArrows : true,
rowLines : true,
singleExpand: true,
listeners: {
checkchange: function( node, checked, a ){
debugger
if(node.hasChildNodes()){
node.eachChild(function(childNode){
childNode.set('checked', checked);
});
}
var arrayLength = node.data.children.length;
if(checked){
if(node.data.children.length > 0){
for (var i = 0; i < arrayLength; i++) {
if(datar[i] !== node.data.children[i].serviceUrl){
datar.push(node.data.children[i].serviceUrl);
}
}
}
if(node.data.children.length == 0){
datar.push(node.data.serviceUrl);
}
}else{
var index = datar.indexOf(node.data.serviceUrl);
if(node.data.children.length == 0){
if(index > -1){
datar.splice(index, 1);
}
}
if(node.data.children.length > 0){
for (var i = 0; i < node.data.children.length; i++) {
datar.splice(node.data.children[i].serviceUrl , 1);
}
}
}
//console.log(datar);
}
},
columns : [{
xtype : 'treecolumn',
text : 'Functionalities',
width : 1065,
sortable: true,
dataIndex : 'serviceName'
},{
xtype : 'treecolumn',
text : 'Network Management Services',
width : 1065,
hidden : true,
dataIndex : 'seqNo'
},{
xtype : 'treecolumn',
text : 'Network Management Services',
width : 1065,
hidden : true,
dataIndex : 'serviceCtgyCd'
},{
xtype : 'treecolumn',
text : 'Network Management Services',
width : 1065,
hidden : true,
dataIndex : 'serviceUrl'
}],
title:'Functionalities'
},

tristan.lee
30 Jun 2015, 7:13 AM
If you comment out your checkchange listener, does the scroll still happen? I am not observing this in any of the Kitchen Sink examples.

aniketpatil014
30 Jun 2015, 7:39 AM
Yes. It is still happening. I debug the code. The scroll is happening in extjs createListenerWrap Method at this call.

return gen.call(dom, e, options, fn, scope, ename, dom, wrap, args, Ext, EventManager);

Also If you have any other design solution for this please share. I am not getting it exactly what is happening here. 8-|

aniketpatil014
1 Jul 2015, 3:13 AM
Hi Lee,

I got the solution. I added below extra listener to suspend events.



itemClick: function( self, record, item, index,eventObj , eOpts ) {
grid = Ext.getCmp('sub-Functionalities-tree');
grid.suspendLayout = true;
},

:):):):):)

Thanks For you help.

tristan.lee
2 Jul 2015, 8:08 AM
Thanks for providing your solution.

This may be a bug within the framework as well. If you could provide a fiddle to demonstrate the issue, I'd be happy to take a look.