PDA

View Full Version : Ext.tree.TreeSorter suspected typo in source code



wsi
25 Jan 2011, 2:40 PM
Version 3.3.1

Section of code below creates improperly scoped variables.

File: ext-all-debug.js
Line 36045 to 36050 is:



var desc = this.dir && this.dir.toLowerCase() == 'desc',
prop = this.property || 'text';
sortType = this.sortType; // <------------- sortType is now global
folderSort = this.folderSort;
caseSensitive = this.caseSensitive === true;
leafAttr = this.leafAttr || 'leaf';


I suspect that it should be



var desc = this.dir && this.dir.toLowerCase() == 'desc',
prop = this.property || 'text',
sortType = this.sortType,
folderSort = this.folderSort,
caseSensitive = this.caseSensitive === true,
leafAttr = this.leafAttr || 'leaf';

aleg
3 Feb 2011, 7:29 PM
As of version 3.3.0 there are actually 5 globally scoped variables introduced by the Ext.treeTreeSorter class. Also, either the docs are wrong or there's a bug with the behavior of the sortType function. Docs say it should be passed tree node instances, yet it's being passed a single node property. Who's been drinking and coding?

onehat
12 Feb 2011, 10:49 AM
I found the above incorrectly scoped vars, as well as these:
Line 16308 of ext-all-debug.js

var flexedHeight = Math.ceil((child.flex / remainingFlex) * remainingHeight);
Needs 'var' before flexedHeight.

Line 36067-36070


var prop1 = attr1[prop],
prop2 = attr2[prop],
v1 = sortType ? sortType(prop1) : (caseSensitive ? prop1 : prop1.toUpperCase()),
v2 = sortType ? sortType(prop2) : (caseSensitive ? prop2 : prop2.toUpperCase());

Needs comma at the end of 36069