TreeGrid freezes during fetch and openFolder calls

Hi Isomorphic,

I have TreeGrid and I’m implementing lookup node mechanism: when TreeGrid shows it automatically navigates to the given node in the tree.

Here is the code that describes the main idea:

treeGrid.dataProperties.dataArrived = function(parentNode) {
	... // here is some condition, preparation etc.
	nextNode = lookupChild(previousNode, code);
	...
	treeGrid.openFolder(nextNode);
	...
	treeGrid.selectRecord(nextNode);
	...
};

treeGrid.fetchRootNodes('*', null, function() {
	...
	treeGrid.openFolder(node);
	...
});

var lookupChild = function(node, code) {
	var children = treeGrid.data.getChildren(node);
	for (var i = 0; i < children.length; i++) {
		var child = children[i];
		if (child.obj.code == code) {
			return child;
		}
	}
	return null;
}

But the problem is that it sometimes work and sometimes does not. The message “Contacting server…” appears, screen freezes and you can’t do anything and should reload an application.

Maybe method dataArrived is called when it is not finished previous time. I can’t find where the problem is. Could you help me?

Firefox show a JavaScript error: “_14 is null” in the next line:
“if(!_11)return;var _13=isc.isA.Number(_2);if(_13&&_2<=0)_2=_5?0:1;var _14=this.getTableElement(_1);if(_2==0&&_5){_14.style.display=“none”}else{_14.style.display=isc.emptyString;for(var i=_7;i<=_8;i++){var _16=this.getTableElement(_1,i);if(_16){var _17=(!isc.Browser.isIE||isc.Browser.isStrict)?this.$o5:this.$27v;if(_5){_16.height=_2;_16.style[_17]=isc.emptyString}else{_16.height=isc.emptyString;_16.style[_17]=_2}”

Best regards,
Ihor.

Hello Ihor,

Have you been able to figure this out?

If not, posting the stack trace of where that JS error is occurring would make it more likely you’ll get help.

Hello Isomorphic,

Could you please explaine how I can get stack trace of JS error? Is it somewhere in Developer Console?

Best regards,
Ihor.

What you could do to get a stack trace of the JS error is to run the page in IE and then call the DevConsole which loads in an IE window. When running in IE, the DevConsole shows a stack trace.

HTH

Log

Hi Guys,

It is log from IE.

18:49:33.125:MUP8:WARN:PlantStructureTree:isc_PlantStructureTree_120:{initWidget} No plantRegistry specified!
18:49:39.750:TMR2:WARN:Animation:Attempt to fire registered animation:{ID: "_1",
target: [TreeGridBody ID:isc_PlantStructureTree_120_body],
callback: Obj,
duration: 1000,
elapsed: 1797,
totalFrames: 25,
currentFrame: 15,
maxDuration: 3000,
acceleration: undef}
Caused an error:'$24t' is null or not an object
18:49:41.046:TMR8:WARN:Animation:Attempt to fire registered animation:{ID: "_2",
target: [TreeGridBody ID:isc_PlantStructureTree_120_body],
callback: Obj,
duration: 1000,
elapsed: 1000,
totalFrames: 25,
currentFrame: 9,
maxDuration: 3000,
acceleration: undef}
Caused an error:'style' is null or not an object
18:49:41.296:XRP3:WARN:Log:Error:
	''style' is null or not an object'
	in http://localhost:8080/KeelBuilderWeb/
	at line 4938
    GridRenderer.setRowHeight(_1=>46,  _2=>280,  _3=>null,  _4=>"",  _5=>true,  _6=>true, true)
    GridRenderer.$28n(_1=>1)
    GridRenderer.finishAnimateRowHeight()
        "if(!this.$28i)return;this.cancelAnimation(this.$28i);this.$28n(1)"
    GridRenderer.finishRowAnimation()
    ListGrid.dataChanged(_1=>undef, _2=>undef, _3=>undef, _4=>undef)
    Class.invokeSuper(_1=>null, _2=>"dataChanged", _3=>undef, _4=>undef, _5=>undef, _6=>undef, _7=>undef, _8=>undef, _9=>undef, _10=>undef)
    Class.Super(_1=>"dataChanged", _2=>Obj{length:0}, _3=>undef)
    TreeGrid.dataChanged()
    dataChangedObservation()
    Tree.linkNodes(_1=>Array[6], _2=>"id", _3=>"parentId", _4=>"<root>", _5=>undef, _6=>Obj{name:ar38052})
    ResultTree.loadChildrenReply(_1=>Obj, _2=>Array[6], _3=>Obj)
    Class.fireCallback(_1=>Obj, _2=>"dsResponse,data,dsRequest", _3=>Array[3], _4=>[ResultTree ID:isc_ResultTree_127], _5=>undef) on [Class Class]
    Class.fireCallback(_1=>Obj, _2=>"dsResponse,data,dsRequest", _3=>Array[3], _4=>undef)
        "return isc.Class.fireCallback(_1,_2,_3,this,_4)"
    DataSource.$38b(_1=>Array[6], _2=>Obj, _3=>Obj, _4=>Obj, _5=>Obj)
    DataSource.$50h(_1=>Obj, _2=>Array[6], _3=>Obj)
        "var _4=_3.$374;this.$38b(_2,_1,_4,_1,_3)"
    ** recursed on Class.fireCallback

You can probably get around this by disabling folder animations (animateFolders:false). It’s unclear how exactly you’re triggering this, best guess is, in the midst of a folder animation, the data was reset such that the empty message is showing and the animation tried to continue anyway. An isolated test case with some dummy data would be great, if you have the time.

Thanks

Thanks guys. It works. But if I understood correctly this is bug with animation.

It’s not completely clear, but if you can take the time to narrow this down to a test case, we can take a look and correct a bug if there is one.

Presumably, you would be able to do this by just adding a bit of custom logic to one of the existing samples.