模态上的 DevExpress PivotGrid 控件不起作用,加载栏一直弹出并且在 ASP.NET MVC 时不会消失

DevExpress PivotGrid controls on modal don't work, loading bar pops up all the time and doesn't disappear at ASP.NET MVC

我需要使用 asp.net mvc 在项目中打开一个按钮触发的弹出窗口。我用 Ajax 发送一个参数,并将部分视图设置为模态的主体。数据传入,创建了数据透视表,但数据透视表事件不起作用。当我在弹出窗口的枢轴网格上单击分页或排序时,文本“正在加载”并且它永远不会消失。我在某处遗漏了什么吗?当它显示弹出窗口时,我调用了 AdjustControl 方法,但它不起作用。它占用了我很多时间,但我仍然找不到解决方案。我请求你的支持。

按钮

<button type="button" class="btn btn-sm btn-block btn-primary" data-toggle="modal" data-target="#modalView" onclick="RetrieveStokMiktari('@Url.Action("RetrieveStokMiktari", "AnaBayi")')">
                        <i class="fas fa-list"></i> Stok Miktarını Getir
</button>

Ajax 调用参数

  function RetrieveStokMiktari(url) {
        debugger;
        var token = $('input[name="__RequestVerificationToken"]').val();
        var kaliteId = $('#kaliteDropdown').val();
        var kaliteAdi = $('#kaliteDropdown').find(':selected').text();
        var obj = { kaliteId: kaliteId, kaliteAdi: kaliteAdi };
        AjaxCall(url,
                obj,
                "GET")
            .done(
                function (data) {
                    $("#modalView .modal-body").html(data);
                    $("#modalView .modal-dialog");
                    $("#modalView .modal-title").text('Shipment Files');
                    $("#modalView").modal("show");
                    $("#modalView").on("shown.bs.modal", function () { PivotGrid1.AdjustControl(); });
                }).fail(function (error) {
                    alert(error.StatusText);
                    toastr.error("Hata : " + error.StatusText, "Hata");
                });
    }

自定义ajax方法

 function AjaxCall(url, data, type) {
        return $.ajax({
            url: url,
            type: type ? type : 'GET',
            data: data,
            contentType: 'application/json'
        });
    }

ASP.NET MVC 控制器和动作

public ActionResult RetrieveStokMiktari(int kaliteId, string kaliteAdi)
    {
        try
        {
            IEnumerable<HrkHaliStok> list = new List<HrkHaliStok>();
            if (Session["Username"] != null)
            {
                UserTnmKullaniciViewModel user = (UserTnmKullaniciViewModel)Session["Username"];
                string filtre = FiltreOku(kaliteId, Convert.ToInt32(user.FIR_ID));
                using (MrnSiparisEntities mrnSiparisEntities = new MrnSiparisEntities())
                {
                    string sql = " SELECT KALITE, EBAT, DESEN, RENK, ISNULL(SUM(MIKTAR), 0) AS MIKTAR " +
                                 " FROM HRK_HALI_STOK " +
                                 " WHERE (KALITE = @kaliteAdi) " + filtre +
                                 " GROUP BY KALITE, EBAT, DESEN, RENK ";

                    list = mrnSiparisEntities.Database.SqlQuery<HrkHaliStok>(sql, new SqlParameter("@kaliteAdi", kaliteAdi)).ToList();
                }
            }

            return PartialView("StokMiktarBilgisi", list);
        }
        catch (Exception e)
        {
            Console.WriteLine(e);
            throw;
        }
    }

局部视图

@using System.Web.UI.WebControls
@model IEnumerable<MerinosWebSiparis.Models.HrkHaliStok>

@{
 Layout = null;
}

@Html.DevExpress().PivotGrid(settings =>
{
settings.Name = "PivotGrid1";


settings.OptionsCustomization.AllowDrag = true;
settings.OptionsView.ShowFilterHeaders = true;
settings.Width = Unit.Percentage(100);
settings.Fields.Add(field =>
{
    field.Area = PivotArea.RowArea;
    field.FieldName = "KALITE";
    field.Caption = "KALITE";
});
settings.Fields.Add(field =>
{
    field.Area = PivotArea.RowArea;
    field.FieldName = "DESEN";
    field.Caption = "DESEN";
});
settings.Fields.Add(field =>
{
    field.Area = PivotArea.RowArea;
    field.FieldName = "RENK";
    field.Caption = "RENK";
});
settings.Fields.Add(field =>
{
    field.Area = PivotArea.DataArea;
    field.FieldName = "MIKTAR";
    field.Caption = "MIKTAR";
});
settings.Fields.Add(field =>
{
    field.Area = PivotArea.ColumnArea;
    field.FieldName = "EBAT";
    field.Caption = "EBAT";
});
}).Bind(Model).GetHtml()

@Html.DevExpress().GetScripts(  
new Script { ExtensionSuite = ExtensionSuite.Editors },  
new Script { ExtensionSuite = ExtensionSuite.GridView },  
new Script { ExtensionSuite = ExtensionSuite.NavigationAndLayout }  
)  

@Html.DevExpress().GetStyleSheets(  
new StyleSheet { ExtensionSuite = ExtensionSuite.Editors },  
new StyleSheet { ExtensionSuite = ExtensionSuite.GridView },  
new StyleSheet { ExtensionSuite = ExtensionSuite.NavigationAndLayout }  
)  

已解决。我使用了 DevExtreme dxPivotGrid。它解决了我的问题。这是对我有帮助的Link