We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Filter for NULL and empty values

Thread ID:





131334 Jul 5,2017 12:30 PM UTC Jul 6,2017 03:47 PM UTC ASP.NET Core 1
Tags: Grid
Asked On July 5, 2017 12:30 PM UTC

I am looking for a way to use filterbar and filter also NULL end empty values. There is EnableComplexBlankFilter() Method that 'It sets the value that indicates to perform the filter operation with empty, null and undefined values.' but I cant find any information about how it should be used?

Farveen Sulthana Thameeztheen Basha [Syncfusion]
Replied On July 6, 2017 03:47 PM UTC

Hi Customer, 

Thanks for contacting syncfusion support. 

Filtering  “NULL and empty values”  by using EnableComplexBlankFilter() method only supports for Excel type of filtering. But we have achieved your requirement filtering null and empty values using “ filterBarTemplate” property.  In the “read” event of the Template column,  we have get the filtered value and stored it in filterObject. After that we have pushed the filterObject into the this.model.filterSettings.filterColumns property and updated the Grid with refreshContent() method. 

Please refer to the code example:- 

<script type="text/javascript"> 
        $(function () { 
                allowPaging :true, 
                           columns: [ 
                            field: "ShipName", width: 100, filterBarTemplate: { 
                                create: function (args) { 
                                    return "<input>" 
                                write: function (args) { 
                                    var data = ej.DataManager(shipDetails).executeLocal(new ej.Query().select("ShipName")); 
                                    args.element.ejAutocomplete({ width: "100%", dataSource: data, enableDistinct: true, focusOut:       ej.proxy(args.column.filterBarTemplate.read, this, args) }); 
                                read: function (args) { 
                                          var filterObject = { 
                                             value:  args.element.val(), 
                                             field:  "ShipName", 
                                             operator: (args.element.val() == ''|| args.element.val() == null)? "equal" : "startswith", 
                                             type: "string", 
                                             predicate: "and", 
                           { field: "ShipCity", headerText: "Ship City", width: 80 } 
       var shipDetails = [ 
          { ShipName: null, ShipCity: 'Brazil' }, 
          { ShipName: 'Ale', ShipCity: 'USA' }, 
          { ShipName: 'Ricardo Adocicados', ShipCity: 'Brazil' } 

Please refer to the sample and API link :-  http://jsplayground.syncfusion.com/aoeqapkf 

Please get back to us if you need any further assistance. 


Farveen sulthana T 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon