kendo treeview e.slice is not a function

1 posts, 0 answers
  1. Cristobal
    Cristobal avatar
    1 posts
    Member since:
    Aug 2017

    Posted 23 Aug Link to this post

    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();
                }
            }
        });

     

     

Back to Top