Hierarchical Datasource

2 posts, 0 answers
  1. Chris GNB
    Chris GNB avatar
    3 posts
    Member since:
    Jul 2014

    Posted 25 Jul 2014 Link to this post

    Can anyone help here. I'm new to using Kendo mobile / platform and have 3 content types defined on everlive

    Orders - Parent
    OrderItems - Child 1:n
    OrderSignatures - Child 1:1

    I know i have to use the hierarchical DS but how do i define the modal and wire up the datasource.
    Any help appreciated.
    Cheers Chris

     var ordersModel = (function () {
            var orderModel = {
                id: "OrderNumber",
                fields: {
                    OrderNumber: { field: 'OrderNumber' },
                    CustomerAddress: { field: 'CustomerAddress' },
                    CustomerName: { field: 'CustomerName' },
                    CustomerNumber: { field: 'CustomerNumber' },
                    ProductName: { field: 'ProductName' },
                    QuantityOrdered: { field: 'QuantityOrdered' },
                    DeliveryDate: { field: 'DeliveryDate', defaultValue: new Date() },
                    QuantityDelivered: { field: 'QuantityDelivered', defaultValue: 0 },
                    Signature: { field: 'Signature' },
                    AcceptedBy: {field: 'AcceptedBy'}
                DeliveryDateFormatted: function () {
                    return kendo.toString(new Date(this.DeliveryDate.toString()), 'MM/dd/yyyy')
            var ordersDataSource = new kendo.data.DataSource({
                type: 'everlive',
                schema: {
                    model: orderModel
                transport: {
                    typeName: 'Orders'
                change: function (e) {

                    if (e.items && e.items.length > 0) {
                    } else {

            }); //datasource
            return {
                orders: ordersDataSource
  2. Anton Dobrev
    Anton Dobrev avatar
    604 posts

    Posted 25 Jul 2014 Link to this post

    Hi Chris,

    Telerik Backend Services have a dedicated way for retrieving the related items - the Expand for Relations functionality. There is also a way to create a hierarchical data source using the Everlive JS SDK.

    Here are the relevant resources from the documentation:
    The Kendo UI team has a dedicated sample about binding a mobile list view to a hierarchical data source. It can be reached here.

    In addition, it may be beneficial to consider the query patterns of your app in advance and if needed, re-design the data schema of your app. Below you can find some details about this.

    Telerik Backend Services offer a NoSQL, document-based data store. In NoSQL databases it is generally better to have the related items embedded into the parent document, since getting related items is more difficult (it requires more requests to the DB). When the items are embedded whenever you get the main item you can choose if you also want to get the embedded items or not (using a projection operation from the JS SDK). This is a kind of de-normalization that is often recommended for non-relational data storages.

    For instance, if you are going to retrieve the Orders always with their signature, the signature seems like the perfect candidate for embedding. Same applies for the OrderItems - they could also be embedded into the parent Order. There might be some variations on this depending on your requirements, the way you are going to show the information to the users, etc.

    Surely, embedding items is not always possible. For example, when a single item is related to more than one other items. The difficult part is retrieving the related items, since you cannot do JOINs. For those scenarios Telerik Backend Services provide Relations and Expand pieces of functionality. Please, note that they are not a replacement of JOIN queries and can also impose some limitations.

    Please, let us know if further questions arise.

    Anton Dobrev
    Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
Back to Top