kendo cannot read property slice of undefined

Thread is closed for posting
2 posts, 0 answers
  1. Janice
    Janice avatar
    1 posts
    Member since:
    Sep 2015

    Posted 02 Sep 2015 Link to this post

    Hi, I have encountered this problem when I run my project.

    This is my jsp page.
    <!DOCTYPE html>
        <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
    <title>Compliance Check Report</title>
    <script type="text/javascript" src="telerik/js/jquery.min.js"></script>
    <script type="text/javascript" src="telerik/js/kendo.all.min.js"></script>
    <script type="text/javascript" src="telerik/js/angular.min.js"></script>
    <link href="telerik/styles/kendo.common.min.css" rel="stylesheet" />
    <link href="telerik/styles/kendo.dataviz.min.css" rel="stylesheet" />
    <link href="telerik/styles/kendo.blueopal.min.css" rel="stylesheet" />
    <link href="telerik/styles/kendo.dataviz.blueopal.min.css" rel="stylesheet" />
    <style scoped>
            .k-grid {font-size:10px}
                <div id = "compliance_check">
                        <label for="domain">Domain Name: </label><input id="domain_name"
                            style="width: 300px" style="height:10px" />
                        <label for="from">From (m/dd/yyyy): </label><input id="date" style="width: 350px" />
                        <label for="to">To (m/dd/yyyy): </label><input id="date2" style="width: 300px" />
                    <p><button class="k-button" id="submit">Submit</button></p>
                    <div id="complianceCheck"></div>
            $(document).ready(function() {
                  function startChange() {
                    var startDate = from.value(),
                    endDate = to.value();
                    if (startDate) {
                        startDate = new Date(startDate);
                    } else if (endDate) {
                        from.max(new Date(endDate));
                    } else {
                        endDate = new Date();
                function endChange() {
                    var endDate = to.value(),
                    startDate = from.value();
                    if (endDate) {
                        endDate = new Date(endDate);
                    } else if (startDate) {
                        end.min(new Date(startDate));
                    } else {
                        endDate = new Date();
                var from=$("#date").kendoDatePicker({
                  change: startChange,
                  parseFormats: ["yyyyMMdd"]
              var to = $("#date2").kendoDatePicker({
                  change: endChange,
                  parseFormats: ["yyyyMMdd"]
              $("#submit").click(function() {
                var domain_name=$('#domain_name').val();
                var date=kendo.toString(from.value(),"yyyyMMdd");
                var date2 = kendo.toString(to.value(),"yyyyMMdd");
                function createGrid(){
                          dataSource: {
                              transport: {
                                read: {
                                      dataType: "json",
                                      url: "http://cdctst1c:12010/complianceCheckReport/GetComplianceCheck",
                                      data: {domain_name:domain_name,date:date,date2:date2},
                              schema: {
                                data: "Compliance_Check",
                              pageSize: 7,
                          width: 800,
                          height: 300,
                          filterable: true,
                          sortable: true,
                          resizable: true,
                          columns: [{
                                      title: "Group",
                                      filterable: true
                                  }, {
                                      title: "Date1",
                                      filterable: true
                                  }, {
                                      title: "Date2",
                                      filterable: true
                $(document).bind("kendo:skinChange", createGrid);
                var complianceCheckHist = $("#complianceCheck").data("kendoGrid");
                    var element = document.getElementById("compliance_check");
                        var textnode = document.createTextNode("No Data");
                        if(element.firstChild.nodeValue!="No Data")
                            element.firstChild.nodeValue="No Data";
                        if(element.firstChild.nodeValue=="No Data");

    Below is the, which is called by the jsp.

    package domain;
    import java.util.Properties;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.json.simple.JSONArray;
    import org.json.simple.JSONObject;
    import splunk.SplunkConnect;
    import com.fasterxml.jackson.databind.ObjectMapper;
    import com.splunk.Event;
    import com.splunk.JobExportArgs;
    import com.splunk.MultiResultsReaderJson;
    import com.splunk.SearchResults;
    import com.splunk.Service;
     * Servlet implementation class GetDumpData
    public class GetComplianceCheck extends HttpServlet {
        private static final long serialVersionUID = 1L;
         * @see HttpServlet#HttpServlet()
        public GetComplianceCheck() {
            // TODO Auto-generated constructor stub
         * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
        protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException {
            doPost(req, resp);
         * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
        protected void doPost(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException {
            // login to splunk
            Service service = SplunkConnect.Connect();
            String domain = req.getParameter("domain_name");
            String earliest1 = req.getParameter("date");
            String latest1 = req.getParameter("date2");
            final PrintWriter out = resp.getWriter();
            String json = "";
            InputStream inputStream = null;
            InputStream input = null;
            Properties splunkProp = new Properties();
            Properties prop = new Properties();
            String search = "";
            try {
                inputStream = new FileInputStream(new File("/appl/eap/project_files/complianceCheckReport/complianceCheckReport_conf.prop"));
                input = new FileInputStream(new File(prop.getProperty("splunk_conf")));
                String query = splunkProp.getProperty("getComplianceCheck");
                search = query.replaceAll("domain=a", domain);
                search = search.replaceAll("earliest=earliest1", "earliest=" + earliest1);
                search = search.replaceAll("latest=latest1", "latest=" + latest1);
            } catch (final IOException ex) {
            } finally {
                if (inputStream != null) {
                    try {
                    } catch (final IOException e) {
                if (input != null) {
                    try {
                    } catch (final IOException e) {
            JobExportArgs jobArgs = new JobExportArgs();
            InputStream exportStream = service.export(search, jobArgs);
            try {
                ObjectMapper mapper = new ObjectMapper();
                MultiResultsReaderJson multiResultsReaderDomain = new MultiResultsReaderJson(exportStream);
                JSONArray arrays = new JSONArray();
                int countset = 0;
                for (SearchResults searchResults : multiResultsReaderDomain) {
                    int count = 0;
                    String resultSetType = searchResults.isPreview() ? "Preview" : "Final";
                    if (resultSetType.equals("Final")) {
                        for (Event event : searchResults) {
                            String group = event.get("group");
                            String Date1 = event.get("DATE1");
                            String Date2 = event.get("DATE2");
                            JSONObject dump = new JSONObject();
                            dump.put("group", group);
                            dump.put("DATE1", Date1);
                            dump.put("DATE2", Date2);
                JSONObject data = new JSONObject();
                data.put("data", arrays);
                json = data.toJSONString();
            } catch (final IOException e) {
                // TODO Auto-generated catch block

    How can I solve the problem??

    Thanks in advance!
  2. Anton Dobrev
    Anton Dobrev avatar
    609 posts

    Posted 07 Sep 2015 Link to this post

    Hello Janice,

    Thanks for posting to the Telerik Developer Forums.

    This error usually occurs at the time of binding a widget to its data source. The reason for this usually is that the data source do not represent an array of data items, which is mandatory for the data binding to succeed.

    For example, in your data source configuration, the response need to return a JSON-formatted object where the key Compliance_Check contains an array of items.

    You need to check this and realign the data source and your service to each other.

    Let me know if you have questions.

    Anton Dobrev
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top