Skip to content

Commit 8771031

Browse files
committed
Fixed bugs in usage of integer as field value.
1 parent 3b91620 commit 8771031

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

CHANGELOG.md

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

33
All notable changes to `laravel-simple-select` will be documented in this file
44

5+
## v1.2.5 - 2021-11-21
6+
7+
- Fixed bugs in usage of integer as field value.
8+
9+
## v1.2.4 - 2021-11-12
10+
11+
- Added default value for `id` prop.
12+
513
## v1.2.3 - 2021-08-11
614

715
- `customSelected` Slot Bug fix.

resources/views/components/script.blade.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,9 @@ function SimpleSelect(config) {
150150
let valueField = this.valueField;
151151
return Object.values(this.dataSource).findIndex(function(x) {
152152
if (typeof x === 'object') {
153-
return x[valueField] === value;
153+
return x[valueField] == value;
154154
} else {
155-
return x === value;
155+
return x == value;
156156
}
157157
});
158158
},
@@ -162,9 +162,9 @@ function SimpleSelect(config) {
162162
let valueField = this.valueField;
163163
let foundValue = Object.values(this.dataSource).find(function(x) {
164164
if (typeof x === 'object') {
165-
return x[valueField] === value;
165+
return x[valueField] == value;
166166
} else {
167-
return x === value;
167+
return x == value;
168168
}
169169
});
170170
return typeof foundValue === 'object' && this.dataSource[index] ? this.dataSource[index][this.textField] : foundValue;
@@ -175,9 +175,9 @@ function SimpleSelect(config) {
175175
let valueField = this.valueField;
176176
let foundValue = Object.values(this.dataSource).find(function(x) {
177177
if (typeof x === 'object') {
178-
return x[valueField] === value;
178+
return x[valueField] == value;
179179
} else {
180-
return x === value;
180+
return x == value;
181181
}
182182
});
183183
return foundValue ?? value;

0 commit comments

Comments
 (0)