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. Image for the cookie policy date
close icon

Filtering not working when cell is null

If one of the columns contains a cell that is null and you want to filter by the given column there is an error.

1 Reply

RS Renjith Singh Rajendran Syncfusion Team September 3, 2019 08:57 AM UTC

Hi Ivan, 

Thanks for contacting Syncfusion support. 

We suggest you to set the “Type” property for the corresponding column to overcome the problem you are facing.  
By default the type for the corresponding column type will be defined based on first record value of the particular column’s data. If the first row data for the column is empty then the type for the column will not be set by default and so the script error will occurred when try perform filter in Grid.  

So to overcome the problem, kindly specify the type for the column using Type property. Please refer the code below, 

<EjsGrid @ref="Grid" @ref:suppressField DataSource="@Orders" AllowFiltering="true" AllowPaging="true" Height="315"> 
       <GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer Name" Type="number" Width="120"></GridColumn> 

   protected override void OnInitialized() 
        Orders = Enumerable.Range(0, 4).Select(x => new Order() 
            OrderID = 1000 + x, 
            CustomerID = (new int?[] { null,8, 9, 10, 11 })[x], //null value for first row data, so it is must to define the Type for “CustomerID” column. 

We are also attaching a sample for your convenience, please download the sample from the link below, 
If you are still facing difficulties, kindly get back to us with the following details for better assistance. 
  1. Share with us the details of the script error you are facing.
  2. Share the details about the type of filter you are using.
  3. Share the sample which you have tried form your side.

Please get back to us if you need further assistance.  

Renjith Singh Rajendran. 

Live Chat Icon For mobile
Up arrow icon