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

kendo treeview e.slice is not a function

0 Answers 228 Views
Report a bug
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Cristobal
Top achievements
Rank 1
Cristobal asked on 24 Aug 2017, 01:51 AM

Hi, I'm trying to load the treeview datasource using POST type request, but is not working and the error is the following: 

kendo.all.js:6704 Uncaught TypeError: e.slice is not a function

    at init.success (kendo.all.js:6704)
    at init.success (kendo.all.js:7704)
    at success (kendo.all.js:6637)
    at Object.n.success (kendo.all.js:5616)
    at fire (jquery-2.2.4.js:3187)
    at Object.fireWith [as resolveWith] (jquery-2.2.4.js:3317)
    at done (jquery-2.2.4.js:8757)
    at XMLHttpRequest.<anonymous> (jquery-2.2.4.js:9123)

 

My code is:

 

var dataSource = new kendo.data.HierarchicalDataSource({
        transport: {
            read: {
                url: urlListarDepartamentoPorPadre,
                dataType: "json",
                type: "POST",
                data: {
                    empresa: $("#cmbEmpresa").val(),
                    id: 1
                }
            }
        },
        requestEnd: function (e) {
            // Fired when a remote service request is finished.
            setTimeout("ExpandirTodosLosNodos()");
        },
        schema: {
            model: {
                id: "Id",
                hasChildren: "TieneHijos"
            }
        }
    });

    $("#treeViewDepartamentos").kendoTreeView({
        checkboxes: {
            // enable checkboxes
            checkChildren: true
        },

        dataSource: dataSource,
        dataTextField: "Nombre",
        // listen for item selection and
        // invert the checkbox state
        select: function (e) {
            e.preventDefault();

            var checkbox = $(e.node).find(":checkbox");
            var checked = checkbox.prop("checked");
            checkbox.prop("checked", !checked);
        },
        check: function (e) {
            var res = e.node;
        },
        dataBound: function (e) {
            if (!this.dataSource.data().length) {
                this.element.append("<p class='no-items'>No tiene departamentos.</p>");
            } else {
                this.element.find(".no-items").remove();
            }
        }
    });

 

 

Tags
Report a bug
Asked by
Cristobal
Top achievements
Rank 1
Share this question
or