This is a migrated thread and some comments may be shown as answers.

Grid Hierarchy ajax request

1 Answer 394 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 22 Apr 2020, 10:03 AM

Hi, I made the sub grid detailInit method but I need an ajax request to the server rather then simple method call

The detailInit method:

detailInit(e) {
        $("<div/>").appendTo(e.detailCell).kendoGrid({
            dataSource: {
                transport: {
                    read: function (readOptions) {
                        debugger;
                        var parameters = {
                            Filter: {
                                FileId: e.data.Id
                            },
                            Skip: readOptions.data.skip ? readOptions.data.skip : 0,
                            Take: readOptions.data.take ? readOptions.data.take : Page_Size
                        };
 
                        return $.ajax({
                            type: "POST",
                            url: "/ImportingStatusReport/GetImportStatusEntityData",
                            contentType: "application/json; charset=utf-8",
                            data: (kendo.stringify({ filter: parameters })),
                            cache: false,
 
                            success: function (returnData) {
                                debugger;
                                readOptions.success(returnData);
                            }
                        });
                    },
                },
                schema: {
                    data: "Data",
                    total: "Total",
                },
                serverGrouping: true,
                serverPaging: true,
                serverSorting: true,
                pageSize: 10,
                filter: { field: "FileId", operator: "eq", value: e.data.Id }
            },
            scrollable: false,
            sortable: true,
            pageable: true,
            columns: [
                { field: "RecordType", title: "Record Type", width: "110px" },
                { field: "ImportStatus", title: "Import Status", width: "110px" },
                { field: "ImportErrors", title: "Import Errors", width: "110px" },
            ]
        });
    }
 

I get data from the backend to the success method but the data isn't displayed on the UI. The sub table is empty. What can be causing this and where to look for the error?

1 Answer, 1 is accepted

Sort by
0
Alex Hajigeorgieva
Telerik team
answered on 24 Apr 2020, 08:42 AM

Hi, Mike,

My guess is that the read function is configured to return an ajax call. I believe that if you remove the return statement, and the response is in the expected format, it will work as expected:

https://docs.telerik.com/kendo-ui/api/javascript/data/datasource/configuration/transport.read#transportread

Here is a sample Dojo for your reference:

https://dojo.telerik.com/@bubblemaster/eyOqegoQ

Regards,
Alex Hajigeorgieva
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
Grid
Asked by
Mike
Top achievements
Rank 1
Answers by
Alex Hajigeorgieva
Telerik team
Share this question
or