ghiscoding / aurelia-slickgrid

Aurelia-Slickgrid is a wrapper of the lightning fast & customizable SlickGrid datagrid, it also includes multiple Styling Themes
https://ghiscoding.github.io/aurelia-slickgrid
MIT License
129 stars 19 forks source link

Multiple number column filters of the same type affects only the last column #345

Closed jani-pernu closed 4 years ago

jani-pernu commented 4 years ago

I'm submitting a Bug report

Your Environment

Software Version(s)
Aurelia 0.6.0
Aurelia-Slickgrid 2.18.1
TypeScript 3.8.2
Operating System Win10
NPM/Node/Yarn 6.13.4/13.5.0.

Expected Behavior

Define multiple columns with FieldType.number and the same filter model inputNumber or compoundInputNumber Now each of these individual columns should be filterable via grid UI Inputted filter text should have effect only to the column the text was inputted

Current Behavior

Inputted filter text is used to the last column with the same filter model Client side filtering: data is filtered by the last column Back end filtering: filter target field is from the last column

  1. Type some filter text to Column1 -> Column2 is sorted with the typed text

Filtering works properly if the filter model is changed to a different one. Col1: inputNumber, Col2: inputNumber -> Not Good Col1: compoundInputNumber, Col2: compoundInputNumber -> Not Good Col1: inputNumber, Col2: compoundInputNumber -> Works! Col1: compoundInputNumber, Col2: inputNumber -> Works!

Also multiple inputText filters work properly.

Code Sample

this.columnDefinitions = [
    {
        id: 'my-column1',
        name: 'Column1',
        field: 'myColumn1',
        filterable: true,
        type: FieldType.number,
        filter: { model: Filters.inputNumber }
    } as Column,
    {
        id: 'my-column2',
        name: 'Column2',
        field: 'myColumn2',
        filterable: true,
        type: FieldType.number,
        filter: { model: Filters.inputNumber }
    } as Column
];
ghiscoding commented 4 years ago

Did that work in previous version? I never heard any complains about this earlier.

I must say, I'm not exactly thrilled to see a bunch of new issues right after a new version (first in 2 months). This is all done in my spare time (many weekends and evenings) and I want to take a break of this. I would be happy to receive help and contributions. I was expecting excitement with the new release, not bugs, oh well šŸ¤£

ghiscoding commented 4 years ago

Ok I found it, I forgot that all new Filters must be registered as Transient so that the DI works as expected while having unique instance.

ghiscoding commented 4 years ago

Fixed and released under the version 2.18.2