apfelsine: Unable to get property 'data' of undefined or null reference

Beitrag lesen

@@apfelsine

Automatisch generierter Code

?? Das heißt, KendoGrid generiert solch fehlerhaften HTML-Code?

yep!

der Part den ich anpassen muss ist hier, und nur hier:

KendoGrid

$("#ReportsProductList").kendoGrid({
                            dataSource: {
                                type: "json",
                                transport: {
                                    read: {
                                            url: "@Html.Raw(Url.Action("ReportsProductList", "TicketPrint"))",
                                            type: "POST",
                                            dataType: "json",
                                            data: addAntiForgeryToken
                                        },
                                    update: function (e){
                                        var updatedItem = e.data.Id;
                                        var reportsid = $('#AddReportsId').val();
                                        var surl = "/TicketPrint/UpdateReportsProduct/" + updatedItem.toString() + "/" + reportsid; 


                                        request = $.ajax({
                                            cache: false,
                                            type: 'POST',
                                            url: surl,
                                            data: addAntiForgeryToken,
                                            dataType: 'json',
                                            success: function (result) {
                                            e.success(result);
                                             },
                                            error: function (result) {
                                             e.error(result)
                                             }});

                                    },
                                    destroy: {
                                        url: "@Html.Raw(Url.Action("ReportsProductDelete","TicketPrint", new RouteValueDictionary { { "Namespaces", "Nop.Plugin.AboTicketSystem20.Controllers" }, { "area", "" } }))",
                                    }
                                },
                                schema: {
                                    data: "Data",
                                    total: "Total",
                                    errors: "Errors",
                                    model: {
                                        id: "Id",
                                        fields: {
                                            Id: { editable: false, type: "number" },
                                            ReportsProductId: { editable: false, type: "number" },
                                            ProductId :{ editable: false, type: "number" },
                                            ReportsId: { editable: false, type: "number" },
                                            ReportsProductId: { editable: false, type: "number" },
                                            FullProductName: { editable: true, type: "string" },
                                            FullReportName: { editable: false, type: "string" }
                                        }
                                    }
                                },
                                requestEnd: function (e) {
                                    if (e.type == "update") {
                                        //Tabelle aktualisieren 
                                        
                                        this.read();
                                    }
                                },
                                error: function (e) {
                                    display_kendoui_grid_error(e);
                                    // Cancel the changes
                                    this.cancelChanges();
                                },
                                pageSize: 10,
                                serverPaging: true,
                                serverFiltering: true,
                                serverSorting: true
                            },
                            pageable: {
                                refresh: true,
                                numeric: false,
                                previousNext: false,
                                info: false
                            },
                            editable: {
                                confirmation: "@T("Admin.Common.DeleteConfirmation")",
                                mode: "inline"
                            },
                            scrollable: false,
                            columns: [{
                                field: "FullProductName",
                                title: "@T("plugins.dds.ticketprint.product.name")",
                                width: 400
                            }, {
                                field: "FullReportsName",
                                title: "@T("plugins.dds.ticketprint.reports.name")",
                                width: 200,
                                editor: function (container, options) {
                                    $('#ReportsId').appendTo(container);
                                    //**hier erwartet Kendogrid sicher keine Id sondern einen Text**

                                }
                            },  {
                                command: [ {
                                    name: "edit",
                                    text: {
                                        edit: "@T("Admin.Common.Edit")",
                                    update: "@T("Admin.Common.Update")",
                                    cancel: "@T("Admin.Common.Cancel")"
                    }
                                },{
                                    name: "destroy",
                                    text: "@T("Admin.Common.Delete")"
                                }]
                               
                    }

                            ]
                        });
                    });