This is a migrated thread and some comments may be shown as answers.

Multifilter not filtering Null values

6 Answers 596 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jamie
Top achievements
Rank 1
Jamie asked on 11 Jun 2019, 02:41 PM

As it stands, the menu filter dropdown Null checkbox doesn't return any of the grids Null values. Is there a way to correct the filters operator or to even remove the checkbox option to filter by Null?

 

https://i.ibb.co/9qr5Vwr/2.png

 

I've had a look through the forum and couldn't find an official response to deal with this issue, there was this thread but I've not stumbled across these filter options before and I'm not interested in updating base code as we reference the most recent kendo from your repos. https://www.telerik.com/forums/multi-filter-with-null-values---they-are-not-visible

 

Thanks in advance.

6 Answers, 1 is accepted

Sort by
0
Alex Hajigeorgieva
Telerik team
answered on 13 Jun 2019, 09:17 AM
Hello, Jamie,

The Kendo UI Grid MultiFilterCheck works with null values since 2018.R1, here is the closed issue that completed this request, also referenced in the thread that you provided:

https://github.com/telerik/kendo-ui-core/issues/3284

For the functionality to work correctly, ensure that the data source schema fields types are defined:

https://docs.telerik.com/kendo-ui/controls/data-management/grid/editing/editing#defining-fields-through-schema

If you do not wish to show the option to filter by null, you can take advantage of the itemTemplate function:

Runnable example: https://dojo.telerik.com/@bubblemaster/UnIBIfuk

filterable: { multi: true, itemTemplate: commonCheckboxTemplate }
 
var commonCheckboxTemplate = function(e) {
  return "#if(data.all || data.value){#" +
    "<div><label><input  type='checkbox' name='"+ e.field +"' value='#= data." + e.field + "#'><span>#= data.all || data.value # </span></label></div>" +
    "#}#"
};

Let us know in case of further questions.

Kind Regards,
Alex Hajigeorgieva
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Jamie
Top achievements
Rank 1
answered on 13 Jun 2019, 12:43 PM

Hi Alex,

 

The Dojo could does exactly what I need but I'm having some issues applying it to my code. The item template seems to be applying correctly and removes the Null option from the dropdown filter. However once I select a value to filter with, it seems to try to apply all the filter options and displays an "On" value in my filter row text box. [see images below]

 

https://ibb.co/VHmpJ0D

https://ibb.co/PWqtSMt

 

I've stripped my code right back and tested it with all my additional functions removed and fields removed and it still exhibits the same behaviour.

 

I've attach my code as well.

 

Kind regards,

 

 

 

 

 

0
Alex Hajigeorgieva
Telerik team
answered on 17 Jun 2019, 12:25 PM
Hi, Jamie,

Thank you very much for the provided snippet.

I was able to use it to reproduce the issue. It came from the template, the checkboxes bind to the filter value, and in this case the value was missing, if you change the template as below, it should work as expected:

<!-- change this -->
<input  type='checkbox' name='" + e.field + "' UNIT='#= data." + e.field + "#'/>
 
<!-- to this -->
<input  type='checkbox' name='" + e.field + "' value='#= data." + e.field + "#'/>

Here is a runnable example using the provided grid configuration:

https://dojo.telerik.com/AyomuMub

Have a look and let me know how you get on with it and if you notice anything incorrect, please let me know the steps to take to reproduce it.

Kind Regards,
Alex Hajigeorgieva
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Jamie
Top achievements
Rank 1
answered on 24 Jun 2019, 08:24 AM

Hi Alex,

 

The example you've provided doesn't work i'm afraid. If you try to filter any of the columns using Null, it returns no results.

 

To get round the issue we ended up just replacing all null values with an empty string at the stored procedure level for all our calls.

 

Thanks for you help though :)

0
Accepted
Alex Hajigeorgieva
Telerik team
answered on 25 Jun 2019, 08:45 AM
Hello, Jamie,

Apologies, I was focusing only on the UNIT field.

To have the example fully working, all the properties types need to described in the schema model definition. I assume that you have tested with the INDUSTRY and PLANT fields as they are the ones which have null values in the data sample. So you can see that after defining their types, everything works as expected:

https://dojo.telerik.com/@bubblemaster/etOMIres/2

schema: {
  model: {
    fields: {
      KEYDATE: { type: "date" },
      UNIT: { type: "string" },
      ACCOUNTNAME: { type: "string"},
      INDUSTRY : { type: "string" }
    }
  }
},



Kind Regards,
Alex Hajigeorgieva
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Jamie
Top achievements
Rank 1
answered on 25 Jun 2019, 08:50 AM
That works perfectly Alex, thank you :)
Tags
Grid
Asked by
Jamie
Top achievements
Rank 1
Answers by
Alex Hajigeorgieva
Telerik team
Jamie
Top achievements
Rank 1
Share this question
or