- Home
- Forum
- ASP.NET MVC
- FilterBarTemplate is not working for Boolean type field columns
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
SIGN IN To post a reply.
5 Replies
VN
Vignesh Natarajan
Syncfusion Team
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
Link: http://www.syncfusion.com/downloads/support/forum/132708/ze/SyncfusionMvcApplication30-1550204005
Please refer our online documentation for filterbarTemplate
Regards,
Vignesh Natarajan
DU
Dushmantha
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
VN
Vignesh Natarajan
Syncfusion Team
September 21, 2017 02:00 PM UTC
Hi Dushmantha,
Thanks for your reply.
We will wait to hear from you.
Regards,
Vignesh Natarajan
DU
Dushmantha
September 26, 2017 07:56 AM UTC
Thanks, team. It works now. I missed making true.
Regards
Dushmantha
VN
Vignesh Natarajan
Syncfusion Team
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.
SIGN IN To post a reply.
- 5 Replies
- 2 Participants
-
DU Dushmantha
- Sep 16, 2017 11:21 AM UTC
- Sep 27, 2017 01:05 PM UTC