简体   繁体   中英

Kendo UI Grid Widget client-side filtering on numeric column

I have the below model schema for a field in my Kendo UI grid widget:

RS_LookBackDays: { type: "number", editable: true },

The columns configuration for the same is :

{ field: "RS_LookBackDays", title: "Rate Schedule – # Lookback Days", type: "number" },

I have a custom client-side filtering on a property that is bound to a text box which is then applied to the dataSource on the click of a search button.

if (ctrl.selectedRS_LookBackDays && ctrl.selectedRS_LookBackDays != '') {
    var filter = { field: "RS_LookBackDays", operator: "eq", value: ctrl.selectedRS_LookBackDays };
    filters.push(filter);
}

ctrl.kendoGrid.dataSource.filter(filters);

There are other filters being applied on 'string' columns which execute successfully and filter the grid data. However, for numeric columns I get a client-side error message : ' TypeError: Object doesn't support property or method 'toLowerCase' ". I am unable to get this work even though I have specified the type on the column as well as the grid.

Solved It. I just had to use the below code:

 var filter = { field: "RS_LookBackDays", operator: "eq", value: kendo.parseInt(ctrl.selectedRS_LookBackDays) };

So silly ! ;)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM