Error while filtering out records from grid

Viewed 1124

We have a kendo react grid and we have the filters dropdown on each column, by which user can provider values and filter out the grid. Those filters are working fine, only one column filter providersCount is breaking, column field datatype is int.

We are getting below error while filtering out:

TypeError: (a || "").indexOf is not a function

Grid code is shown below :

<Grid 
                        data={this.state.items}
                        sortable={{
                        allowUnsort: this.state.allowUnsort,
                        mode: this.state.multiple,
                        sortDir:this.state.sortDir
                    }}

                        sort={this.state.sort}
                        onSortChange={this.sortChange}
                        filterable={true}
                        filter={this.state.filter}
                        onFilterChange={this.filterChange}
                        onPageChange={this.pageChange}
                        total={this.state.total}
                        skip={this.state.skip}
                        pageSize={this.state.pageSize}
                        pageable={this.state.pageable}
                        scrollable={this.state.scrollable}
                        //style={{ height: '500px' }}
                    >
                        <Column field="networkName"  sortable={{
                        allowUnsort: this.state.allowUnsort,
                        mode: this.state.multiple ? 'multiple' : 'single',

                    }}


                    onSortChange={this.sortChange} title="Network Name" width="400px" cell={NetworkNameCell}  />
                        <Column field="networkGroups" title="Network Groups" width="250px" />
                        <Column field="networkType" title="Network Type" width="250px" />
                        <Column field="providersCount" title="Assigned Providers"  />
                        <Column field="locationsCount" title="Assigned Locations"  />
                        <Column cell={this.DeleteCommandCell} title="Action" sortable={false} filterable={false} />
                        <span class="k-icon my-refresh-icon-class"></span>
                    </Grid>

and we are filtering out the records by below function :

  filterNetworks = (filter) => {
        debugger
        const data = this.networks.slice();
        return filterBy(data, filter);
    }

Any idea what we are doing wrong here.

2 Answers

Set filter="numeric" for your column, this way the filter component will have the operators for number comparison and not string comparison. By default the filter is text.

Related