How to resolve "Cannot read Property 'pageSize' of Undefined" error in Kendo UI?

Asked

Viewed 3,071 times

1

Good afternoon guys, I’m making the following mistake:

Uncaught Typeerror: Cannot read Property 'pageSize' of Undefined.

I am working with Kendo UI, trying to generate a list of users using kendoDropDownList, I just haven’t been able to figure out how this part of the system works. I will leave here my two codes, both Javascript and HTML, and if anyone can help me I will thank you very much.

Example of JS code:

$(document).ready(function() {
    $("#orders").kendoDropDownList({
        template: '<span class="order-id">#= OrderID #</span> #= ShipName #, #= ShipCountry #',
        dataTextField: "userName",
        dataValueField: "userId",
        filter: "contains",
        virtual: {
            itemHeight: 26,
            valueMapper: function(options) {
                $.ajax({
                    url: "./db/getListUsers",
                    type: "GET",
                    dataType: "json",
                    data: convertValues(options.data.pageSize,options.data.page),
                    success: function (data,textStatus,jqXHR) { option.success(data,textStatus,jqXHR) },
                    error: function (jqXHR,textStatus,errorThrown) { option.error(jqXHR,textStatus,errorThrown)}
                })
            }
        },
        height: 290,
        dataSource: {
            type: "data",
            transport: {
                read: "./db/getListUsers"
            },
            schema: {
                model: {
                    fields: {
                        data: "users",
                        total: "total"
                    }
                }
            },
            pageSize: 10,
            serverPaging: true,
            serverSorting: false,
            serverFiltering: false
        }
    });
});

function convertValues(value) {
    var data = {};

    value = $.isArray(value) ? value : [value];

    for (var idx = 0; idx < value.length; idx++) {
        data["values[" + idx + "]"] = value[idx];
    }

    return data;
} 

Example of JSP code:

<div>
    <div class="demo-section k-content">
       <h4 style="color:#ddd;"><spring:message code="imexp.ucases.groups.list_users"/></h4>
        <input id="orders" style="width: 20%;" />
    </div> 
</div>
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.