Skip to content

Commit 121b151

Browse files
author
Dmitry Kuzin (DevExpress)
committed
Fix uislider and barrating scrolls
1 parent b61ce9e commit 121b151

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

src/jquery-bar-rating.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ function init(Survey, $) {
44
name: "barrating",
55
title: "Bar rating",
66
iconName: "icon-barrating",
7-
widgetIsLoaded: function () {
7+
widgetIsLoaded: function() {
88
return typeof $ == "function" && !!$.fn.barrating;
99
},
1010
defaultJSON: { choices: [1, 2, 3, 4, 5] },
11-
isFit: function (question) {
11+
isFit: function(question) {
1212
return question.getType() === "barrating";
1313
},
1414
isDefaultRender: true,
15-
activatedByChanged: function (activatedBy) {
15+
activatedByChanged: function(activatedBy) {
1616
Survey.JsonObject.metaData.addClass(
1717
"barrating",
1818
[
@@ -46,31 +46,35 @@ function init(Survey, $) {
4646
]
4747
});
4848
},
49-
afterRender: function (question, el) {
49+
afterRender: function(question, el) {
5050
var $el = $(el).is("select") ? $(el) : $(el).find("select");
51+
$el.parents()[0].style.marginBottom = "3px";
5152
var valueChangingByWidget = false;
52-
var creator = function () {
53+
var creator = function() {
5354
$el.barrating("show", {
5455
theme: question.ratingTheme,
5556
initialRating: question.value,
5657
showValues: question.showValues,
5758
showSelectedRating: false,
58-
onSelect: function (value, text) {
59+
onSelect: function(value, text) {
5960
valueChangingByWidget = true;
6061
question.value = value;
6162
valueChangingByWidget = false;
6263
}
6364
});
6465
};
6566
creator();
66-
question.valueChangedCallback = function () {
67-
if (!valueChangingByWidget && $(el).find("select")[0].value !== question.value) {
67+
question.valueChangedCallback = function() {
68+
if (
69+
!valueChangingByWidget &&
70+
$(el).find("select")[0].value !== question.value
71+
) {
6872
$(el)
6973
.find("select")
7074
.barrating("set", question.value);
7175
}
7276
};
73-
question.__barratingOnPropertyChangedCallback = function (
77+
question.__barratingOnPropertyChangedCallback = function(
7478
sender,
7579
options
7680
) {
@@ -83,7 +87,7 @@ function init(Survey, $) {
8387
question.__barratingOnPropertyChangedCallback
8488
);
8589
},
86-
willUnmount: function (question, el) {
90+
willUnmount: function(question, el) {
8791
var $el = $(el).find("select");
8892
$el.barrating("destroy");
8993
question.valueChangedCallback = undefined;

src/nouislider.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ function init(Survey) {
4343
},
4444
afterRender: function(question, el) {
4545
el.style.paddingBottom = "19px";
46-
el.style.paddingRight = "12px";
46+
el.style.paddingRight = "30px";
47+
el.style.paddingTop = "44px";
4748
el = el.children[0];
4849
el.style.marginBottom = "60px";
4950
var slider = noUiSlider.create(el, {

0 commit comments

Comments
 (0)