Skip to content

Commit

Permalink
SVY-11085 Bootstrapcomponent list issue with empty value in valuelist
Browse files Browse the repository at this point in the history
  • Loading branch information
gboros committed May 3, 2017
1 parent 1013b03 commit ee48d3f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lib/js/bscomponents-common.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
angular.module('bootstrapcomponentscommon',['servoy']).filter('showDisplayValue', function () { // filter that takes the realValue as an input and returns the displayValue
return function (input, valuelist) {
return function (input, valuelist, noEscape) {
var i = 0;
var realValue = input;
if (valuelist) {
Expand Down Expand Up @@ -34,7 +34,7 @@ angular.module('bootstrapcomponentscommon',['servoy']).filter('showDisplayValue'

function getParsedDisplayValue(value) {
if (value === undefined || value === null || value === '') {
return ' '
return noEscape ? ' ' : ' '
} else {
return value;
}
Expand Down
2 changes: 1 addition & 1 deletion list/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<datalist id="{{::model.svyMarkupId}}_datalist">
<option ng-selected="model.dataProviderID === value.realValue" ng-repeat="value in model.valuelistID"
value="{{value.realValue | showDisplayValue:model.valuelistID}}">
value="{{value.realValue | showDisplayValue:model.valuelistID:true}}">
</option>
</datalist>
</div>
11 changes: 6 additions & 5 deletions list/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ angular.module('bootstrapcomponentsList',['servoy', 'bootstrapcomponentscommon']

if($scope.model.valuelistID) {
for (i = 0; i < $scope.model.valuelistID.length; i++) {
if (listValue === $scope.model.valuelistID[i].displayValue) {
var displayValue = $scope.model.valuelistID[i].displayValue;
if (displayValue === undefined || displayValue === null || displayValue === '') {
displayValue = ' ';
}
if (listValue === displayValue) {
listValue = $scope.model.valuelistID[i].realValue;
break;
}
Expand All @@ -38,10 +42,7 @@ angular.module('bootstrapcomponentsList',['servoy', 'bootstrapcomponentscommon']

if($scope.model.valuelistID) {
var showDisplayValueFilter = $filter("showDisplayValue");
var displayValue = showDisplayValueFilter(listValue, $scope.model.valuelistID);
if(displayValue !== '&nbsp;') {
listValue = displayValue;
}
listValue = showDisplayValueFilter(listValue, $scope.model.valuelistID, true);
}

inputEl.val(listValue);
Expand Down

0 comments on commit ee48d3f

Please sign in to comment.