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: Filter model is now FilterConstructor and shouldn't be newed #1169

Merged
merged 1 commit into from
Mar 13, 2024
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
2 changes: 1 addition & 1 deletion docs/column-functionalities/filters/custom-filter.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ You can also create your own Custom Filter with any html/css you want and/or jQu
{ id: 'description', name: 'Description', field: 'description', type: FieldType.string,
filterable: true,
filter: {
model: new CustomInputFilter() // create a new instance to make each Filter independent from each other
model: CustomInputFilter // create a new instance to make each Filter independent from each other
}
}
];
Expand Down
4 changes: 2 additions & 2 deletions docs/migrations/migration-to-2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@ this.columnDefinitions = [
id: 'description', name: 'Description', field: 'description',
filter: {
- type: FilterType.custom,
- customFilter: new CustomInputFilter()
+ model: new CustomInputFilter() // create a new instance to make each Filter independent from each other
- customFilter: CustomInputFilter
+ model: CustomInputFilter // create a new instance to make each Filter independent from each other
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export class CustomAureliaViewModelEditor implements Editor {
async init() {
if (!this.columnEditor?.params?.viewModel) {
throw new Error(`[Aurelia-Slickgrid] For the Editors.aureliaComponent to work properly, you need to fill in the "templateUrl" property of your Custom Element Editor.
Example: this.columnDefs = [{ id: 'title', field: 'title', editor: { model: new CustomAureliaViewModelFilter(), collection: [...], param: { viewModel: MyVM } },`);
Example: this.columnDefs = [{ id: 'title', field: 'title', editor: { model: CustomEditor, collection: [...], param: { viewModel: MyVM } },`);
}
if (this.columnEditor?.params?.viewModel) {
const bindableData = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export class CustomAureliaViewModelFilter implements Filter {

if (!this.columnFilter?.params?.viewModel) {
throw new Error(`[Aurelia-Slickgrid] For the Filters.aureliaComponent to work properly, you need to fill in the "viewModel" property of your Custom Element Filter.
Example: this.columnDefs = [{ id: 'title', field: 'title', filter: { model: new CustomAureliaViewModelFilter(), collection: [...], param: { viewModel: MyVM } },`);
Example: this.columnDefs = [{ id: 'title', field: 'title', filter: { model: CustomFilter, collection: [...], param: { viewModel: MyVM } },`);
}

if (this.columnFilter.params.viewModel) {
Expand Down
2 changes: 1 addition & 1 deletion packages/demo/src/examples/slickgrid/example23.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export class Example23 {
id: 'description', name: 'Description', field: 'description', filterable: true, sortable: true, minWidth: 80,
type: FieldType.string,
filter: {
model: new CustomInputFilter(), // create a new instance to make each Filter independent from each other
model: CustomInputFilter, // create a new instance to make each Filter independent from each other
enableTrimWhiteSpace: true // or use global "enableFilterTrimWhiteSpace" to trim on all Filters
}
},
Expand Down
4 changes: 2 additions & 2 deletions packages/demo/src/examples/slickgrid/example26.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class Example26 {
filterable: true,
sortable: true,
filter: {
model: new CustomAureliaViewModelFilter(),
model: CustomAureliaViewModelFilter,
collection: this.assignees,
params: {
viewModel: FilterSelect
Expand Down Expand Up @@ -132,7 +132,7 @@ export class Example26 {
filterable: true,
sortable: true,
filter: {
model: new CustomAureliaViewModelFilter(),
model: CustomAureliaViewModelFilter,
collection: this.assignees,
params: {
viewModel: FilterSelect
Expand Down
2 changes: 1 addition & 1 deletion packages/demo/src/examples/slickgrid/example4.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export class Example4 {
id: 'description', name: 'Description', field: 'description', filterable: true, sortable: true, minWidth: 80,
type: FieldType.string,
filter: {
model: new CustomInputFilter(), // create a new instance to make each Filter independent from each other customFilter
model: CustomInputFilter, // create a new instance to make each Filter independent from each other customFilter
enableTrimWhiteSpace: true
}
},
Expand Down