Skip to content

Commit

Permalink
refactor(code): remove deprecated "selectOptions" from SelectFilter
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiscoding committed May 26, 2018
1 parent 05568ad commit 532554d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
Expand Up @@ -82,14 +82,11 @@ export class SelectFilter implements Filter {
// ------------------

private buildTemplateHtmlString() {
if (!this.columnDef || !this.columnDef.filter || (!this.columnDef.filter.collection && !this.columnDef.filter.selectOptions)) {
if (!this.columnDef || !this.columnDef.filter || !this.columnDef.filter.collection) {
throw new Error(`[Aurelia-SlickGrid] You need to pass a "collection" for the Select Filter to work correctly. Also each option should include a value/label pair (or value/labelKey when using Locale). For example:: { filter: type: FilterType.select, collection: [{ value: true, label: 'True' }, { value: false, label: 'False'}] }`);
}
if (!this.columnDef.filter.collection && this.columnDef.filter.selectOptions) {
console.warn(`[Aurelia-SlickGrid] The Select Filter "selectOptions" property will de deprecated in future version. Please use the new "collection" property which is more generic and can be used with other Filters (not just Select).`);
}

const optionCollection = this.columnDef.filter.collection || this.columnDef.filter.selectOptions || [];
const optionCollection = this.columnDef.filter.collection || [];
const labelName = (this.columnDef.filter.customStructure) ? this.columnDef.filter.customStructure.label : 'label';
const valueName = (this.columnDef.filter.customStructure) ? this.columnDef.filter.customStructure.value : 'value';
const isEnabledTranslate = (this.columnDef.filter.enableTranslateLabel) ? this.columnDef.filter.enableTranslateLabel : false;
Expand Down
Expand Up @@ -48,9 +48,6 @@ export interface ColumnFilter {
/** Options that could be provided to the Filter, example: { container: 'body', maxHeight: 250} */
filterOptions?: MultipleSelectOption | any;

/** DEPRECATED, please use "collection" instead which is more generic and not specific to a Select Filter. Refer to the Select Filter Wiki page for more info */
selectOptions?: any[];

/** Do we want the Filter to handle translation (localization)? */
enableTranslateLabel?: boolean;

Expand Down

0 comments on commit 532554d

Please sign in to comment.