Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(editor): SingleSelect Editor should show pick false value #75

Merged
merged 2 commits into from
Aug 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ export class Example7 {
model: Editors.singleSelect,

// pass a regular collection array with value/label pairs
// collection: [{ value: '', label: '' }, { value: true, label: 'True' }, { value: false, label: 'False' }],
// collection: [{ value: true, label: 'True' }, { value: false, label: 'False' }],

// Select Editor can also support collection that are async, it could be a Promise (shown below) or Fetch result
collectionAsync: new Promise<any>(resolve => setTimeout(() => {
resolve([{ value: '', label: '' }, { value: true, label: 'True' }, { value: false, label: 'False' }]);
resolve([{ value: true, label: 'True' }, { value: false, label: 'False' }]);
}, 250)),
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export class Example11 {
{
id: 'completed', name: 'Completed', field: 'completed', width: 80, minWidth: 20, maxWidth: 100,
sortable: true, filterable: true,
editor: { model: Editors.singleSelect, collection: [{ value: '', label: '' }, { value: true, label: 'True' }, { value: false, label: 'False' }], },
editor: { model: Editors.singleSelect, collection: [{ value: true, label: 'True' }, { value: false, label: 'False' }], },
filter: {
collection: [{ value: '', label: '' }, { value: true, label: 'True' }, { value: false, label: 'False' }],
model: Filters.singleSelect
Expand Down
3 changes: 1 addition & 2 deletions packages/common/src/editors/selectEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,7 @@ export class SelectEditor implements Editor {
// make sure the prop exists first
this.$editorElm.find('option').each((i: number, $e: any) => {
// check equality after converting originalValue to string since the DOM value will always be of type string
const strValue = currentValue && currentValue.toString && currentValue.toString();
$e.selected = (strValue === $e.value);
$e.selected = (`${currentValue}` === $e.value);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface SlickEditorLock {
* @param editController {EditController}
* @return {Boolean}
*/
isActive(editController: Editor): boolean;
isActive(editController?: Editor): boolean;

/**
* Sets the specified edit controller as the active edit controller (acquire edit lock).
Expand Down
Binary file not shown.