Skip to content

Commit a0d40c3

Browse files
author
Patrick Tsai
committed
Release version 2.4.2
1 parent af815a8 commit a0d40c3

File tree

5 files changed

+29
-7
lines changed

5 files changed

+29
-7
lines changed

dist/jquery.tree-multiselect.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* jQuery Tree Multiselect v2.4.1 | (c) Patrick Tsai | MIT Licensed */
1+
/* jQuery Tree Multiselect v2.4.2 | (c) Patrick Tsai | MIT Licensed */
22
div.tree-multiselect {
33
border: 2px solid #D8D8D8;
44
border-radius: 5px;

dist/jquery.tree-multiselect.js

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* jQuery Tree Multiselect v2.4.1 | (c) Patrick Tsai | MIT Licensed */
1+
/* jQuery Tree Multiselect v2.4.2 | (c) Patrick Tsai | MIT Licensed */
22
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
33
'use strict';
44

@@ -410,6 +410,8 @@ Tree.prototype.createAst = function (options) {
410410
var self = this;
411411
var itemId = 0;
412412
var sectionId = 0;
413+
414+
var initialIndexItems = [];
413415
var keysToAddAtEnd = [];
414416
options.each(function () {
415417
var option = this;
@@ -428,7 +430,8 @@ Tree.prototype.createAst = function (options) {
428430
});
429431

430432
if (item.initialIndex) {
431-
self.keysToAdd[item.initialIndex] = itemId;
433+
initialIndexItems[item.initialIndex] = initialIndexItems[item.initialIndex] || [];
434+
initialIndexItems[item.initialIndex].push(itemId);
432435
} else if (item.selected) {
433436
keysToAddAtEnd.push(itemId);
434437
}
@@ -459,6 +462,7 @@ Tree.prototype.createAst = function (options) {
459462
}
460463
lookupPosition.arr.push(item);
461464
});
465+
this.keysToAdd = Util.array.flatten(initialIndexItems);
462466
Util.array.removeFalseyExceptZero(this.keysToAdd);
463467
(_keysToAdd = this.keysToAdd).push.apply(_keysToAdd, keysToAddAtEnd);
464468
Util.array.uniq(this.keysToAdd);
@@ -837,6 +841,24 @@ function filterInPlace(arr, pred) {
837841
//arr.slice(0, idx);
838842
}
839843

844+
exports.flatten = function (arr, r) {
845+
if (!Array.isArray(arr)) {
846+
return arr;
847+
}
848+
849+
r = r || [];
850+
851+
for (var ii = 0; ii < arr.length; ++ii) {
852+
if (Array.isArray(arr[ii])) {
853+
r.concat(exports.flatten(arr[ii], r));
854+
} else {
855+
r.push(arr[ii]);
856+
}
857+
}
858+
859+
return r;
860+
};
861+
840862
exports.uniq = function (arr) {
841863
var hash = {};
842864

dist/jquery.tree-multiselect.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)