This repository has been archived by the owner on Jun 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 42
Expand all #24
Comments
Hi m found a solution for expanded all; select2totree.js `function buildOptions(dataArr, curLevel, pup) {
|
That will break collapsing nodes (they disappear if you click on them). Here's how to fix that: diff --git a/select2totree.js b/select2totree.js
index 11dfa0d4c..dc3dbbf96 100644
--- a/select2totree.js
+++ b/select2totree.js
@@ -93,6 +93,8 @@
for (var i = 0; i < dataArr.length; i++) {
var data = dataArr[i] || {};
var $opt = $("<option></option>");
+ if (treeData['expandAll'] == true)
+ $opt.addClass('showme');
if (labelPath) {
$opt.text(readPath(data, labelPath));
} else {
@@ -116,6 +118,8 @@
var inc = data[treeData.incFld || "inc"];
if (inc && inc.length > 0) {
$opt.addClass("non-leaf");
+ if (treeData['expandAll'] == true)
+ $opt.addClass("opened");
buildOptions(inc, curLevel+1, $opt.val());
}
} // end 'for' Then just use |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Is there any way to start the select fully expanded instead of collapsed?
The text was updated successfully, but these errors were encountered: