SallyA
SallyA

Reputation: 57

Kendo remote datasource and parameters

I am trying to call the read method but also pass in parameters. Below is my code and I can see the values are being passed but there is an error in the console:

    var dataSource = new kendo.data.DataSource({
        transport: {
            read: {
                url: URL + "/Read?StudentNum=" + studentNum + "AndStudentDept=" + studentDept,
                dataType: "json",
                data: {
                    studentNum: studentNum,
                    studentDept: studentDept
                }
            },
            pageSize: 5,
            schema: {
                data: function (response) {
                    console.log(response);
                    return response.Data.dsstudentReport.ttstudentReport;
                },
            }
        }
    });
The error is: kendo.all.js:7165 Uncaught TypeError: e.slice is not a function

I will continue to keep looking but if anyone could help me identify where I have made a mistake, that would be greatly appreciated. I am new to Kendo and still learning.


Thanks

Upvotes: 0

Views: 497

Answers (1)

dev_in_progress
dev_in_progress

Reputation: 2494

This error often occurs because there is no model in schema. Try to add it. For eg:

transport: {},
schema: {
        model: {
            id: "id",
            fields: {
                name: { type: "string" },
                isActive: { type: "boolean" },
                age: { type: "number" }
            }
        }
    }

It represents data structure that you are fetching with read method.

Ps. schema must be on same level as transport. In your case schema is inside transport

Upvotes: 1

Related Questions