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

b.slice is not a function?

6 Answers 545 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
T.
Top achievements
Rank 1
T. asked on 24 Aug 2012, 12:32 PM
Hi all,

I am trying to get an XML datasource working, but unfortunately without success.
The XML-data I provided locally in a variable. The whole code is below.

If I load the page firebug comes up with an error message:

b.slice is not a function.

Can anyone assist please?
Thanks for any help!


<html>
  <head>
    <link href="/css/kendo/styles/kendo.common.min.css" rel="stylesheet" type="text/css" />
    <link href="/css/kendo/styles/kendo.default.min.css" rel="stylesheet" type="text/css" />
    <!--link href="/css/kendo/styles/kendo.dataviz.min.css" rel="stylesheet" type="text/css" /-->
 
 
    <script src="/js/kendo/js/jquery.min.js" type="text/javascript"></script>
    <script src="/js/kendo/js/kendo.web.min.js" type="text/javascript"></script>
         
  </head>
  <body>
    <div id="grid">
    </div>
  </body>
  <script type="text/javascript">
  $(
    function()
    {
        var dsXMLData = "<items><Item><No>4711</No><Description>Artikel 4711</Description><UnitPrice>12.34</UnitPrice></Item><Item><No>4712</No><Description>Artikel 4712</Description><UnitPrice>24.68</UnitPrice></Item></items>";
             
        var dsXML = new kendo.data.DataSource (
        {
            data: dsXMLData,
            schema:
            {
                type: 'xml',
                data: '/items/Item',
                model:
                {
                    fields:
                    {
                        itemno:         { field: "No/text()" },
                        description:    { field: "Description/text()" },
                        unitprice:      { field: "UnitPrice/text()"  }
                    }
                }
            }
        });
 
        dsXML.read();
         
        $("#grid").kendoGrid(
        {
            columns: [{title: "Artikel Nr.", field: "itemno"},
                      {title: "Beschreibung", field: "description"},
                      {title: "VK-Preis", field: "unitprice"}],
                         
            dataSource:
            {
                data: dsXML
            }
        });
         
     
    }
  );
  </script>
</html>

6 Answers, 1 is accepted

Sort by
0
T.
Top achievements
Rank 1
answered on 31 Aug 2012, 01:47 PM
Hi,

since one week no response, still need help, thanks!
0
Shane
Top achievements
Rank 1
answered on 04 Sep 2012, 07:34 PM
You need to change 

dataSource:
     {
     data: dsXML
 }

to: 

dataSource: dsXML  
0
T.
Top achievements
Rank 1
answered on 14 Sep 2012, 07:00 AM
Hi Shane,

sorry for answering so lately!
What you suggested solved my problem,

many thanks!
0
Jeremy
Top achievements
Rank 1
answered on 29 Apr 2015, 08:25 PM
Ha! Me too! Thanks for posting this three years ago. I just ran into the same thing and you solved it.
0
nitesh
Top achievements
Rank 1
answered on 01 Nov 2016, 07:47 AM
TypeError: e.options.tools.slice is not a function
0
nitesh
Top achievements
Rank 1
answered on 01 Nov 2016, 07:49 AM
TypeError: e.options.tools.slice is not a function  while upgrading kendo.all.min.js v2015.2.624 to Q@ 2016
Tags
Data Source
Asked by
T.
Top achievements
Rank 1
Answers by
T.
Top achievements
Rank 1
Shane
Top achievements
Rank 1
Jeremy
Top achievements
Rank 1
nitesh
Top achievements
Rank 1
Share this question
or