Filter Load

Hi,

I have a view, that load other views in a modal, on Index there is a grid, it's work normally, but a grid that loads from a partial view in a modal works ok but the filter option not. See my code and the image error.

Second Grid:

@(Html.EJ().Grid<object>
                       ("FlatGridOperacao")
                       .Datasource(ds => ds.URL("DataSourceOperacao").BatchURL("BatchUpdateOperacao")
                       .Adaptor(AdaptorType.UrlAdaptor))
                       .EditSettings(edit => { edit.AllowEditing().EditMode(EditMode.Batch); })
                       .AllowPaging()
                       .AllowSorting()
                       .AllowMultiSorting()
                       .AllowFiltering()
                       .FilterSettings(filter => { filter.FilterType(FilterType.Excel); })
                       .AllowGrouping()
                       .AllowReordering()
                       .IsResponsive(true)
                       .EnableResponsiveRow(true)
 
                       .ToolbarSettings(toolBar => toolBar.ShowToolbar().ToolbarItems(items =>
                       {
                           items.AddTool(ToolBarItems.Update);
                       }))
                       .Columns(col =>
 
                       {
                           col.Field("OperacaoID").Visible(false).IsPrimaryKey(true).IsIdentity(true).Add();
                           col.Field("Selecionado").HeaderTextAlign(TextAlign.Center).EditType(EditingType.BooleanEdit).DisplayAsCheckbox(true).Priority(1).Add();
                           col.Field("Modulo").HeaderText("Módulo").AllowEditing(false).HeaderTextAlign(TextAlign.Center).TextAlign(TextAlign.Left).Add();
                           col.Field("Descricao").HeaderText("Descrição").AllowEditing(false).HeaderTextAlign(TextAlign.Center).TextAlign(TextAlign.Left).Add();
                           col.Field("PerfilId").Visible(false).Add();
                       })
                       .ClientSideEvents(eve =>
                       {
                           eve.ActionBegin("gridBegin");
                       })
               )
               @Html.EJ().ScriptManager()

JS Function to add an additional parameter to load Second Grid:

function gridBegin(args) {
        //if ((args.requestType != "filterbeforeopen") && (args.requestType != "filterchoicerequest")) {
            var key = $('#PerfilId').val();
        args.model.query.addParams("PerfilId_", key);
        //}
    }

Attachment: Error_23326991.zip

1 Reply

SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team August 10, 2018 09:26 AM UTC

Hi Fillipe,  
 
Thanks for contacting Syncfusion Support.  
 
We have prepared a sample with the provided code example that can be downloaded from the following location.  
 
Please ensure the following code example with your controller end code. Ensure ‘Where’ and skip/take has been handled correctly in the Grid as follows. 
 

[CS] 

        public ActionResult DataSource(DataManager dm) 
        { 
            IEnumerable data = order; 
            DataOperations DataOperations operation = new DataOperations(); 
            if (dm.Sorted != null && dm.Sorted.Count > 0) //Sorting 
            { 
                data = operation.PerformSorting(data, dm.Sorted); 
            } 
            if (dm.Where != null && dm.Where.Count > 0) //Filtering 
            { 
                data = operation.PerformWhereFilter(data, dm.Where, dm.Where[0].Operator); 
                if(dm.RequiresCounts == false) 
                   return Json(data); // return the search data 
 
            } 
            if (dm.Search != null && dm.Search.Count > 0) //Searching 
            { 
                data = operation.PerformSearching(data, dm.Search); 
            } 
            var count = data.AsQueryable().Count(); 
            if (dm.Skip != 0) 
            { 
                data = operation.PerformSkip(data, dm.Skip); 
            } 
            if (dm.Take != 0) 
            { 
                data = operation.PerformTake(data, dm.Take); 
            } 
            return Json(new { result = data, count = count }); 
        } 
 
 
Also, provide the following details.  
 
  1. Complete code example of the code behind
  2. Stacktrace of browser console (if any error), while opening the Excel filter dialog
  3. Check the network tab and share the request made while opening the excel dialog
  4. Tell the total records counts bound to the Grid like below count
 
 
 
Regards,  
Seeni Sakthi kumar S 


Loader.
Up arrow icon