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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

FilterBarTemplate is not working for Boolean type field columns

Thread ID:

Created:

Updated:

Platform:

Replies:

132708 Sep 16,2017 11:21 AM UTC Sep 27,2017 01:05 PM UTC ASP.NET MVC 5
loading
Tags: Grid
Dushmantha
Asked On September 16, 2017 11:21 AM UTC

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

Vignesh Natarajan [Syncfusion]
Replied On September 18, 2017 12:47 PM UTC

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 
  


Dushmantha
Replied On September 20, 2017 06:54 AM UTC

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


Vignesh Natarajan [Syncfusion]
Replied On September 21, 2017 02:00 PM UTC

Hi Dushmantha, 

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

Regards, 

Vignesh Natarajan 


Dushmantha
Replied On September 26, 2017 07:56 AM UTC

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

Regards

Dushmantha


Vignesh Natarajan [Syncfusion]
Replied On September 27, 2017 01:05 PM UTC

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. 


CONFIRMATION

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.

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

;