Add ignorecase option to tree.

This commit is contained in:
Lars Jung 2015-05-16 14:28:54 +02:00
parent 673afead73
commit 76c226c57b
3 changed files with 11 additions and 2 deletions

View File

@ -7,6 +7,7 @@
* adds search
* adds wide links in tree view
* adds IE edge mode
* adds ignorecase sorting option to tree
* fixes some styles in IE10
* fixes preview bottom bar for small screen widths
* changes API

View File

@ -388,11 +388,13 @@ Options
- show: boolean, initial visible to first time users
- maxSubfolders: number, max number of subfolders to show in tree
- naturalSort: boolean, use natural sort order for folders
- ignorecase: boolean, sort ignorecase
*/
"tree": {
"enabled": true,
"show": true,
"maxSubfolders": 50,
"naturalSort": false
"naturalSort": false,
"ignorecase": true
}
}

View File

@ -4,7 +4,8 @@ modulejs.define('ext/tree', ['_', '$', 'core/event', 'core/location', 'core/reso
enabled: false,
show: true,
maxSubfolders: 50,
naturalSort: false
naturalSort: false,
ignorecase: true
}, allsettings.tree);
var template =
'<div class="item">' +
@ -31,6 +32,11 @@ modulejs.define('ext/tree', ['_', '$', 'core/event', 'core/location', 'core/reso
var val1 = item1.label;
var val2 = item2.label;
if (settings.ignorecase) {
val1 = val1.toLowerCase();
val2 = val2.toLowerCase();
}
return settings.natural ? util.naturalCmpFn(val1, val2) : util.regularCmpFn(val1, val2);
}