Filter doesn't work if the value is mapped to 0

0 Answers 20 Views
Data Source Filter Grid
Mark
Top achievements
Rank 1
Mark asked on 06 May 2022, 04:26 AM

We are facing filter issue on Kendo Grid when filter value is mapped to 0, below is the piece of code.

(We are applying existing filters to the new datasource to get the expected result)

Code:

BulkTaggingDataSource.read().then(function () {
  var filter = {};
  if ($("#FoodGrid").data("kendoGrid").dataSource.filter()) {
       filter.filter = $("#FoodGrid").data("kendoGrid").dataSource.filter();
  }

var query = kendo.data.Query.process(BulkTaggingDataSource.read.data(), filter);

 $.each(query.data, function (index, content) {
         $.each(query.data, function (index, content) {
                   if ($.inArray(content.id, checkedIds) < 0) {
                       checkedIds[content.id] = state;
                   }
         })
   })
});

Filter which we get from $("#FoodGrid").data("kendoGrid").dataSource.filter(): is 

In our case if the {field: 'TotalHours', operator: 'eq', value: '0'} if the filter value is '0'
we get the query.data as empty array and we wont get the expected result.

and filter will work if the {field: 'TotalHours', operator: 'eq', value: '5'}

we are facing issue only for '0' filter. and in schema we have declared 'TotalHours' as number.

Kindly let us know how to fix this issue.

Georgi Denchev
Telerik team
commented on 10 May 2022, 08:01 AM

Hi, Mark,

I've shared my response in the other forum ticket, let us continue the discussion there.

Best Regards,

Georgi

No answers yet. Maybe you can help?

Tags
Data Source Filter Grid
Asked by
Mark
Top achievements
Rank 1
Share this question
or