Skip to content

Commit

Permalink
fix(editors): use indexOf in multiple select editor to load value
Browse files Browse the repository at this point in the history
indexOf must be used because defaultValue is an array. the current state
is broken and values are not loaded when the multiple select list is
opened
  • Loading branch information
jmzagorski committed Apr 18, 2018
1 parent 2bb0de7 commit 599a803
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export class MultipleSelectEditor implements Editor {
this.defaultValue = item[this.columnDef.field].map((i: any) => i.toString());

this.$editorElm.find('option').each((i: number, $e: any) => {
if (this.defaultValue === $e.value) {
if (this.defaultValue.indexOf($e.value) !== -1) {
$e.selected = true;
} else {
$e.selected = false;
Expand Down
4 changes: 2 additions & 2 deletions aurelia-slickgrid/src/examples/slickgrid/example3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export class Example3 {
type: FieldType.string,
editor: Editors.multipleSelect,
params: {
collection: Array.from(Array(10).keys()).map(k => ({ value: `Task ${k}`, label: `Task ${k}` })),
collection: Array.from(Array(12).keys()).map(k => ({ value: `Task ${k}`, label: `Task ${k}` })),
collectionSortBy: {
property: 'label',
sortDesc: true
Expand Down Expand Up @@ -213,7 +213,7 @@ export class Example3 {
start: new Date(randomYear, randomMonth, randomDay),
finish: new Date(randomYear, (randomMonth + 1), randomDay),
effortDriven: (i % 5 === 0),
prerequisites: (i % 5 === 0) && i > 0 ? [`Task ${i}`, `Task ${i - 1}`] : []
prerequisites: (i % 2 === 0) && i !== 0 && i < 12 ? [`Task ${i}`, `Task ${i - 1}`] : []
};
}
this.dataset = mockedDataset;
Expand Down

0 comments on commit 599a803

Please sign in to comment.