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

FilterBarTemplate is not working for Boolean type field columns

Hi Team,

I am using the  "FilterBarTemplate" for a custom drop-down filters in both string type field and boolean type. But string type field filter is rendering, but boolean field not. in here I used Template for boolean type column as well.

Below is my code sample, please have a look and help me to resolve this. 

@(Html.EJ().Grid<DeviceManagerViewModel>("deviceGrid")
                          .Datasource(ds => ds.URL(@Url.Action("GetAllDevicesForGrid", "DeviceManager")).Adaptor(AdaptorType.UrlAdaptor))
                          .AllowPaging()
                          .AllowSorting()
                          .AllowFiltering()
                          .FilterSettings(f => { f.ShowFilterBarStatus(false);})
                          .IsResponsive(true)
                          .MinWidth(600)
                          .ToolbarSettings(toolbar =>
                          {
                              if (User.IsInRole("Admin"))
                              {
                                  toolbar.ShowToolbar().CustomToolbarItems(new List<object>
                              {
                                      new CustomToolbarItem {TemplateID = "#Add", Text = "Add New"},
                                      new CustomToolbarItem {TemplateID = "#Update", Text = "Update"},
                                      new CustomToolbarItem {TemplateID = "#Delete", Text = "Delete"},
                                      new CustomToolbarItem {TemplateID = "#Activate", Text = "Activate"},
                                      new CustomToolbarItem {TemplateID = "#refresh", Text = "Refresh"}

                                  });
                              }
                          })
                          .EditSettings(edit => { edit.AllowEditOnDblClick(false); })
                          .ClientSideEvents(evt =>
                          {
                              evt.ActionFailure("gridActionEvent.failureMessage");
                              evt.ToolbarClick("toolbarClickEvent.onClickToolbar");
                              evt.ActionBegin("gridActionEvent.onBegin");
                              evt.ActionComplete("gridActionEvent.onComplete");
                          })
                          .Columns(col =>
                          {
                              col.Field(p => p.Id).Visible(false).IsPrimaryKey(true).Add();
                              col.Field(p => p.DeviceId).HeaderText("Device Id").TextAlign(TextAlign.Left).AllowSorting(true).AllowFiltering(true).Add();
                              col.Field(p => p.DeviceBrandName).HeaderText("Device Brand").FilterBarTemplate(filterbar => filterbar.Write("dropdown_write").Read("dropdown_read")).TextAlign(TextAlign.Left).AllowSorting(true).Add();
                              col.Field(p => p.DeviceModelName).HeaderText("Device Model").TextAlign(TextAlign.Left).AllowSorting(true).AllowFiltering(true).Add();
                              col.Field(p => p.CreatedBy).HeaderText("Last Updated By").TextAlign(TextAlign.Left).AllowFiltering(true).AllowSorting(true).Add();
                              col.Field(p => p.IsActive).HeaderText("Is Active").Template("#IsActiveTemplate").FilterBarTemplate(filterbar => filterbar.Write("isActiveDropdown_Write").Read("isactiveDropdown_Read")).TextAlign(TextAlign.Left).AllowFiltering(false).Add();
                          }));

Thanks in advance
Dushmantha

5 Replies

VN Vignesh Natarajan Syncfusion Team September 18, 2017 07:47 AM

Hi Dushmantha, 

Thanks for using Syncfusion products. 

We have analyzed your query. You have set allowFiltering as false for the Boolean type column. So that the dropdown is not rendered. Please set the allow filtering as true and check again. Please refer the below code snippet 
 .Columns(col => 
                          { 
                              col.Field(p => p.Id).Visible(false).IsPrimaryKey(true).Add(); 
                              col.Field(p => p.DeviceId).HeaderText("Device Id").TextAlign(TextAlign.Left).AllowSorting(true).AllowFiltering(true).Add(); 
                              col.Field(p => p.DeviceBrandName).HeaderText("Device Brand").FilterBarTemplate(filterbar => filterbar.Write("dropdown_write").Read("dropdown_read")).TextAlign(TextAlign.Left).AllowSorting(true).Add(); 
                              col.Field(p => p.DeviceModelName).HeaderText("Device Model").TextAlign(TextAlign.Left).AllowSorting(true).AllowFiltering(true).Add(); 
                              col.Field(p => p.CreatedBy).HeaderText("Last Updated By").TextAlign(TextAlign.Left).AllowFiltering(true).AllowSorting(true).Add(); 
                              col.Field(p => p.IsActive).HeaderText("Is Active").Template("#IsActiveTemplate").FilterBarTemplate(filterbar => filterbar.Write("isActiveDropdown_Write").Read("isactiveDropdown_Read")).TextAlign(TextAlign.Left).AllowFiltering(false).Add(); 
                          })); 
 

Please remove the highlighted text from your code snippet and try again.  

For your convenience, we have prepared a sample which can be downloaded from below link 
Please refer our online documentation for filterbarTemplate   

Regards, 
Vignesh Natarajan 
  



DU Dushmantha September 20, 2017 01:54 AM

Thanks for your reply, I will check it, I think I  changed it to 'True' and check, but it's not working, Anyway will try again. 

Thanks

Dushmantha



VN Vignesh Natarajan Syncfusion Team September 21, 2017 09:00 AM

Hi Dushmantha, 

Thanks for your reply.  
We will wait to hear from you.  

Regards, 

Vignesh Natarajan 



DU Dushmantha September 26, 2017 02:56 AM

Thanks, team. It works now. I missed making true.

Regards

Dushmantha



VN Vignesh Natarajan Syncfusion Team September 27, 2017 08:05 AM

Hi Dushmantha, 

Thanks for your feedback. We are happy that our solution resolved your issue. 

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

Regards 
Vignesh Natarajan. 


Loader.
Live Chat Icon For mobile
Up arrow icon