Telerik 网格显示不存在的列 ASP.NET MVC

Telerik grid showing non-existent columns ASP.NET MVC

我正在准备示例报告屏幕, 用户将从下拉框中选择报告并填写一些特殊选项。 单击搜索按钮(Sorgula)后,它会从 ReportController 中读取操作。

此控制器 Returns 将(无论您想要什么)列为 Json

现在可以了。 但是 Telerik Grid 添加了我从未添加到结果中的不同列。

网格上没有我定义的列。因为列必须根据 json 结果

出现

现在我的网格创建查询

$("#ReportResult").kendoGrid({
        selectable: "multiple cell",
        allowCopy: true,
        height: 550,
        groupable: true,
        pageable: true,
        sortable: true,

        pageable: {
             input: true,
            numeric: false
        },

        dataSource: new kendo.data.GanttDataSource({
            pageSize: 20,
            serverPaging: true,
            serverFiltering: true,
            serverSorting: true,
             transport: {
            read: {
                url: '<%= Url.Action("Read", "Report") %>',
                dataType: "json",
                type: "POST",
                data: {
                    ReportID: 1,
                    OrganizationID: 2,
                    StartDate: "22",
                    EndDate: "11",
                    UserName:"dds",
                },
            },
        },

        }),


    });

读取动作

public ActionResult Read([DataSourceRequest] DataSourceRequest request, int ReportID,int OrganizationID,string StartDate,string EndDate,string UserName)
    {

        List<COnsumersReport> lis = new List<COnsumersReport>();
        for (int i = 0; i < 99; i++)
        {
            COnsumersReport cc = new COnsumersReport();
            cc.ID = i;
            cc.name = "semih";
            cc.sirname = "Yıldız";
            cc.Borc =i*20.5;
            lis.Add(cc);
        }


        return Json(lis);
    }

结果。如您所见,id、parentId、orderId、Title vs 尚未由我定义。

    public class COnsumersReport
    {
        public int ID { get; set; }
        public string  name { get; set; }
        public string sirname { get; set; }
        public double Borc { get; set; }
    }

原因是网格数据源。我已经习惯了 kendo.data.GanttDataSource 大数据源添加自动列。

当我尝试使用时 kendo.data.DataSource 问题已解决。

 dataSource: new kendo.data.DataSource({
        pageSize: 100,
        serverPaging: true,
            transport: {
                read:  {
                    url: '<%= Url.Action("Read", "Report") %>',
                    dataType: "json", 
                    type: "GET",
                    data: {
                        ReportID: $('#Rapor').val(),
                        OrganizationID: $('#Organizations').val(),
                        StartDate: $('#datepicker').val(),
                        EndDate: $('#datepickerEndDate').val(),
                        UserName: $('#userName').val(),
                    },                        
                },                    
            },
        error: function (req, textStatus, errorThrown) {
            console.log("Error Verdi" + textStatus + ' ' + errorThrown);
        },
        schema: {
            total: function (response) {
            return ResultCount;
            } 
        }
       }),