Transfer and read additional XML-data in the grid data source

2 posts, 0 answers
  1. Chris
    Chris avatar
    3 posts
    Member since:
    Mar 2012

    Posted 24 Mar 2017 Link to this post

    I'm using Kendo UI Grid with XML as DataSource. I want to transfer additional data in the XML as the grid data.

    My dataSource schema looks like this

    schema: {
    type: "xml",
    id: "field 1",
    data: "/data/dataset",
    total: "/total/text()",
    model: {
    fields: {
    field1: "field1/text()",
    field2: "field2/text()"
    }
    }
    }

    My XML like this:

    <total>1</total><data><dataset><field1>test</field1><field2>test</field2></dataset></data>

    No i want to transfer additional data like this:

    <total>1</total><data><dataset><field1>test</field1><field2>test</field2></dataset></data><additionaldata>test</additionaldata>

    and i want to have access on it it in the "dataBound" event. Is it possible and if how? I hope someone can help me.
  2. Preslav
    Admin
    Preslav avatar
    570 posts

    Posted 28 Mar 2017 Link to this post

    Hi Chris,

    I believe that it is not possible to access the additional data with this schema. A possible solution might be adding the additionaldata field to the data/dataset. For example,

    schema: {
        type: "xml",
        id: "field 1",
        data: "/data/dataset",
        total: "/total/text()",
        model: {
            fields: {
                field1: "field1/text()",
                field2: "field2/text()",
                additionaldata: "additionaldata/text()"
            }
        }
    }
    <total>1</total><data><dataset><field1>test</field1><field2>test</field2><additionaldata>test</additionaldata></dataset></data>

    Additionally, more information regarding the schema.data configuration is available here:

    http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#configuration-schema.data

    Regards,
    Preslav
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top