aurelia-v-grid / vGrid

Aurelia-v-grid - npm source
MIT License
49 stars 10 forks source link

Using "contains" filter throws an error #56

Closed Thanood closed 7 years ago

Thanood commented 7 years ago

I'm using the rebuilt grid in a view with a simple configuration:

<v-grid v-grid-connector.bind="gridConnector" v-row-height="25" v-header-height="50" v-panel-height="25" v-footer-height="25" style="height:400px">
  <v-grid-col col-width="200" col-pin-left="true" col-sort="commonName" col-filter="commonName|*" col-field="commonName"></v-grid-col>
  <v-grid-col col-width="400" col-header-name="DN" col-sort="distinguishedName" col-filter="distinguishedName" col-field="distinguishedName"></v-grid-col>
</v-grid>

When I enter something into the "commonName" filter, I'm getting this error: TypeError: this.valueFormater.fromView is not a function at VGridAttributesFilter.getValue

I think this is because of the valueConverters getter returning a function:

  get valueConverters(): {fromView: Function; toView: Function} {
    if (this.vGrid) {
      let valueConverter = this.vGrid.viewResources.getValueConverter.bind(this.vGrid.viewResources);  // <-- function returned here
      return valueConverter;
    } else {
      return {fromView: () => {/* nothing */ }, toView: () => {/* nothing */ } };
    }
  }

It leads to this.valueFormater being a function and not having a fromView member. I guess this should be the result of the function instead.

vegarringdal commented 7 years ago

fixed in https://github.com/vegarringdal/vGrid/commit/38f32396c75d09a67fbd95fdc4923dc867176e38 Also pushed new build

Thanood commented 7 years ago

confirmed :+1: