Skip to content

Commit 587767e

Browse files
author
Dmitry Kuzin (DevExpress)
committed
2 parents 6668a43 + b346ea6 commit 587767e

File tree

4 files changed

+33
-17
lines changed

4 files changed

+33
-17
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
### [1.8.21](https://github.com/surveyjs/custom-widgets/compare/v1.8.20...v1.8.21) (2020-12-15)
6+
7+
### [1.8.20](https://github.com/surveyjs/custom-widgets/compare/v1.8.19...v1.8.20) (2020-12-09)
8+
9+
### [1.8.19](https://github.com/surveyjs/custom-widgets/compare/v1.8.18...v1.8.19) (2020-12-08)
10+
511
### [1.8.18](https://github.com/surveyjs/custom-widgets/compare/v1.8.17...v1.8.18) (2020-12-01)
612

713
### [1.8.17](https://github.com/surveyjs/custom-widgets/compare/v1.8.16...v1.8.17) (2020-11-26)

package-lock.json

Lines changed: 4 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "surveyjs-widgets",
3-
"version": "1.8.18",
3+
"version": "1.8.21",
44
"scripts": {
55
"start": "npm run build && live-server",
66
"watch": "webpack --env.buildType dev --watch",

src/select2.js

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,22 +145,38 @@ function init(Survey, $) {
145145
);
146146
updateChoices();
147147
$el.on("select2:select", function (e) {
148-
question.renderedValue = e.target.value;
149-
updateComment();
148+
setTimeout(function() {
149+
question.renderedValue = e.target.value;
150+
updateComment();
151+
}, 1);
152+
});
153+
$el.on('select2:opening', function(e) {
154+
if ($(this).data('unselecting')) {
155+
$(this).removeData('unselecting');
156+
e.preventDefault();
157+
}
150158
});
151159
$el.on("select2:unselecting", function (e) {
152-
question.renderedValue = null;
153-
updateComment();
160+
$(this).data('unselecting', true);
161+
setTimeout(function() {
162+
question.renderedValue = null;
163+
updateComment();
164+
}, 1);
154165
});
155166
question.valueChangedCallback = updateValueHandler;
156167
updateValueHandler();
157168
},
158169
willUnmount: function (question, el) {
170+
question.readOnlyChangedCallback = null;
171+
question.valueChangedCallback = null;
159172
var $select2 = $(el).find("select");
160173
if (!!$select2.data("select2")) {
161-
$select2.off("select2:select").select2("destroy");
174+
$select2
175+
.off("select2:select")
176+
.off("select2:unselecting")
177+
.off("select2:opening")
178+
.select2("destroy");
162179
}
163-
question.readOnlyChangedCallback = null;
164180
},
165181
};
166182

0 commit comments

Comments
 (0)