Skip to content
This repository was archived by the owner on Jun 19, 2024. It is now read-only.

Commit 8c9fc1e

Browse files
author
clivezhg
committed
the fix of a searching issue: searching state is not cleared after opening dropdown
1 parent ec483f2 commit 8c9fc1e

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/select2totree.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* Select2-to-Tree CSS 1.1.0
2+
* Select2-to-Tree CSS 1.1.1
33
* https://github.com/clivezhg/select2-to-tree
44
*/
55
.s2-to-tree * {

src/select2totree.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* Select2-to-Tree 1.1.0
2+
* Select2-to-Tree 1.1.1
33
* https://github.com/clivezhg/select2-to-tree
44
*/
55
(function ($) {
@@ -10,11 +10,11 @@
1010
buildSelect(opts.treeData, this);
1111
}
1212

13-
opts.tr_old = opts.templateResult;
13+
opts._templateResult = opts.templateResult;
1414
opts.templateResult = function (data, container) {
1515
var label = data.text;
16-
if (typeof opts.tr_old === "function") {
17-
label = opts.tr_old(data, container);
16+
if (typeof opts._templateResult === "function") {
17+
label = opts._templateResult(data, container);
1818
}
1919
var $iteme = $("<span class='item-label'></span>").append(label);
2020
if (data.element) {
@@ -43,7 +43,7 @@
4343
s2inst.on("select2:open", function (evt) {
4444
var s2data = s2inst.data("select2");
4545
s2data.$dropdown.addClass("s2-to-tree");
46-
s2data.$dropdown.find(".searching-result").removeClass("searching-result");
46+
s2data.$dropdown.removeClass("searching-result");
4747
var $allsch = s2data.$dropdown.find(".select2-search__field").add( s2data.$container.find(".select2-search__field") );
4848
$allsch.off("input", inputHandler);
4949
$allsch.on("input", inputHandler);

0 commit comments

Comments
 (0)