Skip to content

Commit

Permalink
refactor(editors): serialize select editors to actual type
Browse files Browse the repository at this point in the history
not sure why i thought I should always make the serialized value a string. Probabaly because I was chaning the `dateEditor` at the same time. Anyway, the serailied value from the `valueName` property should always be a simple type.
  • Loading branch information
jmzagorski committed May 16, 2018
1 parent 2ee03b0 commit 016f070
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,7 @@ export class MultipleSelectEditor implements Editor {
}

applyValue(item: any, state: any): void {
item[this.args.column.field] = this.collection
.filter(c => state.indexOf(c[this.valueName].toString()) !== -1)
.map(c => c[this.valueName]);
item[this.args.column.field] = state;
}

destroy() {
Expand All @@ -143,7 +141,7 @@ export class MultipleSelectEditor implements Editor {
}

serializeValue(): any {
return this.$editorElm.val();
return this.currentValues;
}

focus() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ export class SingleSelectEditor implements Editor {
}

applyValue(item: any, state: any): void {
item[this.args.column.field] = findOrDefault(this.collection, (c: any) =>
c[this.valueName].toString() === state)[this.valueName];
item[this.args.column.field] = state;
}

destroy() {
Expand All @@ -135,7 +134,7 @@ export class SingleSelectEditor implements Editor {
}

serializeValue(): any {
return this.$editorElm.val();
return this.currentValue;
}

focus() {
Expand Down

0 comments on commit 016f070

Please sign in to comment.