- Home
- Forum
- ASP.NET MVC
- Column Filter not working
Column Filter not working
Hi,
I am using Syncfusion Grid excel filtering, but is not working when I click the column filter icon.
Here is my code:
VIEW
@(Html.EJ().Grid<FamiliasData>("Familias")
.Datasource(ds => ds.Json((IEnumerable<FamiliasData>)ViewBag.Familias).UpdateURL("UpdateFamilias").InsertURL("AddFamilias").RemoveURL("DeleteFamilias").Adaptor(AdaptorType.RemoteSaveAdaptor))
.EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing(); })
.AllowFiltering()
.FilterSettings(filter =>
{
filter.FilterType(FilterType.Excel);
})
.ToolbarSettings(toolbar =>
{
toolbar.ShowToolbar().ToolbarItems(items =>
{
items.AddTool(ToolBarItems.Add);
items.AddTool(ToolBarItems.Edit);
items.AddTool(ToolBarItems.Delete);
items.AddTool(ToolBarItems.Update);
items.AddTool(ToolBarItems.Cancel);
});
})
.AllowPaging()
.Locale("es-MX")
.PageSettings(page => { page.PageSize(15); })
.Columns(col =>
{
col.Field("Id").IsPrimaryKey(true).Visible(false).Add();
col.Field("Marca_Id").HeaderText("Marca").ForeignKeyField("Value").ForeignKeyValue("Text").TextAlign(TextAlign.Center).Width(30).AllowEditing(true).CssClass("myHeader").HeaderTextAlign(TextAlign.Left).DataSource(((IEnumerable<object>)ViewBag.Marcas)).Add();
col.Field("Name").HeaderText("Familia").TextAlign(TextAlign.Center).Width(20).CssClass("myHeader").HeaderTextAlign(TextAlign.Left).Add();
})
.ClientSideEvents(eve => { eve.ActionBegin("begin").EndEdit("endEdit").EndAdd("endAdd"); })
)
.Datasource(ds => ds.Json((IEnumerable<FamiliasData>)ViewBag.Familias).UpdateURL("UpdateFamilias").InsertURL("AddFamilias").RemoveURL("DeleteFamilias").Adaptor(AdaptorType.RemoteSaveAdaptor))
.EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing(); })
.AllowFiltering()
.FilterSettings(filter =>
{
filter.FilterType(FilterType.Excel);
})
.ToolbarSettings(toolbar =>
{
toolbar.ShowToolbar().ToolbarItems(items =>
{
items.AddTool(ToolBarItems.Add);
items.AddTool(ToolBarItems.Edit);
items.AddTool(ToolBarItems.Delete);
items.AddTool(ToolBarItems.Update);
items.AddTool(ToolBarItems.Cancel);
});
})
.AllowPaging()
.Locale("es-MX")
.PageSettings(page => { page.PageSize(15); })
.Columns(col =>
{
col.Field("Id").IsPrimaryKey(true).Visible(false).Add();
col.Field("Marca_Id").HeaderText("Marca").ForeignKeyField("Value").ForeignKeyValue("Text").TextAlign(TextAlign.Center).Width(30).AllowEditing(true).CssClass("myHeader").HeaderTextAlign(TextAlign.Left).DataSource(((IEnumerable<object>)ViewBag.Marcas)).Add();
col.Field("Name").HeaderText("Familia").TextAlign(TextAlign.Center).Width(20).CssClass("myHeader").HeaderTextAlign(TextAlign.Left).Add();
})
.ClientSideEvents(eve => { eve.ActionBegin("begin").EndEdit("endEdit").EndAdd("endAdd"); })
)
CONTROLLER:
[HttpGet]
public ActionResult AgregarFamilia()
{
Familias model = new Familias();
Marcas mar = new Marcas();
ViewBag.Familias = model.getFamilias();
ViewBag.Marcas = mar.getMarcaFamilia();//
return View(model);
}
public ActionResult AgregarFamilia()
{
Familias model = new Familias();
Marcas mar = new Marcas();
ViewBag.Familias = model.getFamilias();
ViewBag.Marcas = mar.getMarcaFamilia();//
return View(model);
}
MODEL:
public List<object> getMarcaFamilia()
{
List<object> result = new List<object>();
var query = dc.Marca.OrderBy(x => x.Marca1);
foreach (var item in query)
{
result.Add(new { Value = item.Id, Text = item.Marca1 });
}
return result;
}
{
List<object> result = new List<object>();
var query = dc.Marca.OrderBy(x => x.Marca1);
foreach (var item in query)
{
result.Add(new { Value = item.Id, Text = item.Marca1 });
}
return result;
}
Really appreciate the support,
Thanks
Laura Jordan
SIGN IN To post a reply.
3 Replies
VN
Vignesh Natarajan
Syncfusion Team
February 19, 2019 11:31 AM UTC
Hi Laura,
Thanks for contacting Syncfusion support.
Query : I am using Syncfusion Grid excel filtering, but is not working when I click the column filter icon.
From your query, we understand that you are facing issue while filtering the foreign key column. we have prepared a sample using your code example. We are not able to reproduce the mentioned issue on our side. We have prepared a sample for your reference with the same requirement.
Please refer the below link for the sample
Please share the following details so that we may provide the appropriate solution as soon as possible.
- You have mentioned that you are facing the issue while clicking on the filter icon. So ,please share whether you are facing the issue in filtering the column values or in opening of the filter dialog.
- Share the video demo or screenshot of the issue.
- If possible please try to reproduce the mentioned issue in the attached sample.
Refer our help documentation for the foreignkey adaptor to perform the operations like sort/group/filter based on the ForeignKeyField instead of Field value.
Please get back to us with above details if you still face the issue.
Regards,
Vignesh Natarajan.
LJ
Laura Jordan
February 19, 2019 10:43 PM UTC
Hi Vignesh,
Attachment: attachment_739856a1.rar
Thanks for your response but I couldn´t download the zip attachment it shows an error.
I attach the screen of the result of clicking the filtering icon of the my Grid example, hoping you can help me up.
Thanks,
Laura Jordan
Attachment: attachment_739856a1.rar
VN
Vignesh Natarajan
Syncfusion Team
February 20, 2019 08:36 AM UTC
Hi Laura,
Thanks for the update.
Still we are not able to reproduce the issue on our side. The mentioned issue may occur if you use Remote data and fail to handle the data in the server side for the Excel Filter checkbox list. So, please share whether you are using any other adaptor instead of remoteSaveAdaptor.
We have attached the sample again for your reference. So, if possible please try to reproduce the issue in the attached sample.
Regards,
Vignesh Natarajan
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
LJ Laura Jordan
- Feb 18, 2019 10:35 PM UTC
- Feb 20, 2019 08:36 AM UTC