2
votes

I am a bit knew to the kendo stuff hence i am seeking your help. i am trying display a kendo grid using xml data. However the rows of the grid are shown empty.i am trying fetch the data from the url(http://demos.kendoui.com/service/Northwind.svc/Products) and set the data source on the kendo widget. Once i run the sample (http://jsfiddle.net/visibleinvisibly/c3qsdjq0/19/) it shows empty grid. I believe this is happening as i am not able to set the "data" property in the "schema" object of the datasource.I wouldnt like to use json for this sample

Below is the sample Xml data

<feed xml:base="http://demos.telerik.com/kendo-ui/service/Northwind.svc/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">
    .............................
    ...........................
  <entry>
   ..................
    ....................
    <content type="application/xml">
      <m:properties>
        <d:ProductID m:type="Edm.Int32">1</d:ProductID>
        <d:ProductName>Chai</d:ProductName>
        <d:UnitPrice m:type="Edm.Decimal">18.00</d:UnitPrice>    
      </m:properties>
    </content> 
     </entry>
  </feed>

The data property in schema is set like this

schema: {
 type: "xml",
 data: "/feed/entry/content/properties",
 model: {
         fields: {
            ProductID: "ProductID/text()",
            ProductName: "ProductName/text()",
            UnitPrice: "UnitPrice/text()"
         }
     }
 }

Thanks in advance,

alex.

1

1 Answers

0
votes

@Alex - Below is my analysis -

Point No.1 - data not displayed

When I try to run your jsfiddle sample (http://jsfiddle.net/visibleinvisibly/c3qsdjq0/19/) in chrome, I get below error in console -

"XMLHttpRequest cannot load http://demos.kendoui.com/service/Northwind.svc/Products?take=10&skip=0&page=1&pageSize=10. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://fiddle.jshell.net' is therefore not allowed access."

enter image description here

This clearly indicates why content is not displayed in your Kendo UI grid.

Point No. 2 - Using XML

I tried to use XML type using AngularJS and I got below error-

"Unknown DataSource transport type 'xml'.
Verify that registration scripts for this type are included after Kendo UI on the page."

enter image description here

I believe, this means they are XML as datasource transport type cannot be used. You will have to rely on JSON or ODaata.

Hope this will help!

Cheers Sanket