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"); })
)
CONTROLLER:
[HttpGet]
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;
}
Really appreciate the support,
Thanks
Laura Jordan