ASP .Net MVC 각도 j, syncfusion 그리드를 사용하고 있습니다.NullReferenceException excelexport syncfusion grid
이 오류는 그리드의 데이터row가 필터링되지만 필터가 적용되지 않은 경우 작동합니다. 그리드를 필터링해야 필터링 할 수 없습니다.
내 필터는 다음과 같이 코딩 :
obj.filterColumn("ClientID", "equal", Id_ "and", true);
내 그리드 :
jQuery("#myGrid").ejGrid({
dataSource: dataManager,
columns: cols,
allowSelection: true,
enableAltRow: false,
enableRowHover: true,
isResponsive: true,
allowSearching: true,
selectionSettings: { selectionMode: ["row"] },
allowFiltering: true,
allowSorting: true,
allowScrolling: true,
allowResizeToFit: true,
allowPaging: true,
pageSettings: { pageSize: 12 },
toolbarSettings: { showToolbar: true, toolbarItems: [ej.Grid.ToolBarItems.ExcelExport] },
toolbarClick: function (e) {
this.exportGrid = this["export"];
if (e.itemName == "Excel Export") {
this.exportGrid('/MyController/ExportToExcel')
e.cancel = true;
},
수출 JS :
var gridObj = $("#myGrid").data("ejGrid");
gridObj.export(url);
컨트롤러 :
012,351을 6,[System.Web.Http.ActionName("ExcelExport")]
[AcceptVerbs("POST")]
public void ExportToExcel()
{
string gridModel = HttpContext.Request.Params["GridModel"];
GridProperties gridProperty = ConvertGridObject(gridModel);
ExcelExport exp = new ExcelExport();
var items = _svc.GetItems(someFilters);
exp.Export(gridProperty, items, "Export.xlsx", ExcelVersion.Excel2010, false, false, "flat-saffron"); //the error i in this line
}
스택 트레이스 :
[NullReferenceException: Object reference not set to an instance of an object.]
Syncfusion.JavaScript.DataSources.DataOperations.PerformFiltering(IEnumerable dataSource, List`1 filteredColumns) +193
Syncfusion.JavaScript.DataSources.DataOperations.Execute(IEnumerable dataSource, GridProperties property) +61
Syncfusion.EJ.Export.GridExcelExport.ExecuteResult(GridProperties GridModel, Object dataSource) +431
Syncfusion.EJ.Export.GridExcelExport.ExportHelper(GridProperties gridModel, Object dataSource) +777
Syncfusion.EJ.Export.GridExcelExport.Export(GridProperties gridModel, Object dataSource, Boolean multipleExport) +20
SwapZilla.Controllers.CollateralPostingController.ExportToExcel() in D:\Dev\MyProject\Controllers\MyController.cs:187
System.Web.Mvc.<>c__DisplayClass1.<WrapVoidAction>b__0(ControllerBase controller, Object[] parameters) +15
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +252
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +34
System.Web.Mvc.Async.<>c__DisplayClass42.<BeginInvokeSynchronousActionMethod>b__41() +33
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +56
System.Web.Mvc.Async.<>c__DisplayClass39.<BeginInvokeActionMethodWithFilters>b__33() +76
System.Web.Mvc.Async.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49() +370
System.Web.Mvc.Async.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49() +370
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +57
System.Web.Mvc.Async.<>c__DisplayClass2a.<BeginInvokeAction>b__20() +32
System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +184
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +50
System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) +24
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +22
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +64
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +22
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +50
System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +38
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +22
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +50
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +607
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +134
내가 그리드 및 항목의 데이터 소스에서 열이 동일한 지 확인하고, 필터링되지가 조롱 경우가 수출한다는 사실에 의해 확인입니다. 또한 동일한 행을 가지고 있지만 그리드보다 다른 행 수가없는 항목의 행을 내보내려고했기 때문에 중요하지 않다고 생각합니다.
어떻게 해결할 수 있습니까?