diff --git a/aurelia-slickgrid/src/aurelia-slickgrid/editors/multipleSelectEditor.ts b/aurelia-slickgrid/src/aurelia-slickgrid/editors/multipleSelectEditor.ts index 178c3be75..aa37d3fbc 100644 --- a/aurelia-slickgrid/src/aurelia-slickgrid/editors/multipleSelectEditor.ts +++ b/aurelia-slickgrid/src/aurelia-slickgrid/editors/multipleSelectEditor.ts @@ -106,7 +106,7 @@ export class MultipleSelectEditor implements Editor { } // user might want to sort the collection - if (this.gridOptions && this.gridOptions.params && this.columnDef.params.collectionSortBy) { + if (this.columnDef.params && this.columnDef.params.collectionSortBy) { const sortBy = this.columnDef.params.collectionSortBy; newCollection = this.collectionService.sortCollection(newCollection, sortBy, this.enableTranslateLabel); } @@ -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; diff --git a/aurelia-slickgrid/src/aurelia-slickgrid/editors/singleSelectEditor.ts b/aurelia-slickgrid/src/aurelia-slickgrid/editors/singleSelectEditor.ts index 927de4df2..bed47e619 100644 --- a/aurelia-slickgrid/src/aurelia-slickgrid/editors/singleSelectEditor.ts +++ b/aurelia-slickgrid/src/aurelia-slickgrid/editors/singleSelectEditor.ts @@ -98,7 +98,7 @@ export class SingleSelectEditor implements Editor { } // user might want to sort the collection - if (this.gridOptions.params && this.columnDef.params.collectionSortBy) { + if (this.columnDef.params && this.columnDef.params.collectionSortBy) { const sortBy = this.columnDef.params.collectionSortBy; newCollection = this.collectionService.sortCollection(newCollection, sortBy, this.enableTranslateLabel); } diff --git a/aurelia-slickgrid/src/aurelia-slickgrid/filters/multipleSelectFilter.ts b/aurelia-slickgrid/src/aurelia-slickgrid/filters/multipleSelectFilter.ts index f7ba25e89..babebcce4 100644 --- a/aurelia-slickgrid/src/aurelia-slickgrid/filters/multipleSelectFilter.ts +++ b/aurelia-slickgrid/src/aurelia-slickgrid/filters/multipleSelectFilter.ts @@ -92,7 +92,7 @@ export class MultipleSelectFilter implements Filter { } // user might want to sort the collection - if (this.gridOptions.params && this.columnDef.filter.collectionSortBy) { + if (this.columnDef.filter && this.columnDef.filter.collectionSortBy) { const sortBy = this.columnDef.filter.collectionSortBy; newCollection = this.collectionService.sortCollection(newCollection, sortBy, this.enableTranslateLabel); } diff --git a/aurelia-slickgrid/src/aurelia-slickgrid/filters/singleSelectFilter.ts b/aurelia-slickgrid/src/aurelia-slickgrid/filters/singleSelectFilter.ts index 453bd3538..88d66a907 100644 --- a/aurelia-slickgrid/src/aurelia-slickgrid/filters/singleSelectFilter.ts +++ b/aurelia-slickgrid/src/aurelia-slickgrid/filters/singleSelectFilter.ts @@ -84,7 +84,7 @@ export class SingleSelectFilter implements Filter { } // user might want to sort the collection - if (this.gridOptions.params && this.columnDef.filter.collectionSortBy) { + if (this.columnDef.filter && this.columnDef.filter.collectionSortBy) { const sortBy = this.columnDef.filter.collectionSortBy; newCollection = this.collectionService.sortCollection(newCollection, sortBy, this.enableTranslateLabel); } diff --git a/aurelia-slickgrid/src/examples/slickgrid/example12.ts b/aurelia-slickgrid/src/examples/slickgrid/example12.ts index 2ba043e7b..9b95216c8 100644 --- a/aurelia-slickgrid/src/examples/slickgrid/example12.ts +++ b/aurelia-slickgrid/src/examples/slickgrid/example12.ts @@ -79,7 +79,8 @@ export class Example12 { filter: { collection: [{ value: '', label: '' }, { value: 'TRUE', labelKey: 'TRUE' }, { value: 'FALSE', labelKey: 'FALSE' }], collectionSortBy: { - property: 'labelKey' // will sort by translated value since "enableTranslateLabel" is true + property: 'labelKey', // will sort by translated value since "enableTranslateLabel" is true + sortDesc: true }, type: FilterType.singleSelect, enableTranslateLabel: true, diff --git a/aurelia-slickgrid/src/examples/slickgrid/example3.ts b/aurelia-slickgrid/src/examples/slickgrid/example3.ts index d910f5185..4a569f6b6 100644 --- a/aurelia-slickgrid/src/examples/slickgrid/example3.ts +++ b/aurelia-slickgrid/src/examples/slickgrid/example3.ts @@ -163,7 +163,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 @@ -217,7 +217,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; diff --git a/aurelia-slickgrid/src/examples/slickgrid/example4.ts b/aurelia-slickgrid/src/examples/slickgrid/example4.ts index 202621a0d..4473e46f0 100644 --- a/aurelia-slickgrid/src/examples/slickgrid/example4.ts +++ b/aurelia-slickgrid/src/examples/slickgrid/example4.ts @@ -81,6 +81,11 @@ export class Example4 { filterable: true, filter: { collection: multiSelectFilterArray, + collectionSortBy: { + property: 'value', + sortDesc: true, + fieldType: FieldType.number + }, type: FilterType.multipleSelect, searchTerms: [1, 33, 50], // default selection // we could add certain option(s) to the "multiple-select" plugin