Custom properties for resources dataSource to bind in groupHeaderTemplate

4 posts, 0 answers
  1. Andrea
    Andrea avatar
    1 posts
    Member since:
    Jan 2015

    Posted 27 Jan 2015 Link to this post

    Hi,

    I'm using KendoUI Scheduler and I'm grouping the events by "owner". The entity "owner" has got properties like:

    {
      name: 'Andrea',
      id: '1',
      pictureUrl: 'http://someurl.com/someresource'
    }


    I tried to inject a groupHeaderTemplate like this:

    <script id="groupHeaderTemplate" type="text/x-kendo-template">
        <strong style="color: red">#=text#</strong>
        <img src="#= image#" alt="person" height="50" />
    </script>


    ... initializing the scheduler like this:

    $(".scheduler").kendoScheduler({
        .
        .
        .
        resources: [
            {
                field: "owners",
                name: "Owners",
                dataSource: [
                    { text: myOwners[0].name, value: myOwners[0].id, image: myOwners[0].pictureUrl},
                    { text: myOwners[1].name, value: myOwners[1].id, image: myOwners[1].pictureUrl},
                    { text: myOwners[2].name, value: myOwners[2].id, image: myOwners[2].pictureUrl}
                ],
                multiple: true,
                title: "Owners"
            }
        ]
     });


    Unforunately I get the error:
    Uncaught ReferenceError: image is not defined

    I've been looking around within the documentation but I didn't find a way to customize the model of the resources schema.
    Am I missing something or is it actually impossible to achieve what I'm trying?

    Thanks for the support!
    Andrea









  2. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2172 posts

    Posted 29 Jan 2015 Link to this post

    Hello Andrea,

    Currently to the "groupHeaderTemplate" are passed only the following fields:
    • color - dataColorField value
    • field - field from the event which used to match the resource
    • name - name of the resource
    • text - dataTextField value
    • title - title of the resource
    • value - dataValueField value

    If you need to access additional fields of the resource you should get the scheduler object, find the needed resource object using the "name" field and search it's dataSource to find the needed resource by id (value).

    Regards,
    Vladimir Iliev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
  4. Alexander
    Alexander avatar
    11 posts
    Member since:
    Aug 2011

    Posted 16 Jul in reply to Vladimir Iliev Link to this post

    Is it still the same? Looks like a missing of a really helpful feature.

  5. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2172 posts

    Posted 18 Jul Link to this post

    Hi Alex,

    This is still not supported out of the box, however you can find working example of finding the needed resource in the following forum post:

    Regards,
    Vladimir Iliev
    Telerik by Progress
     
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
     
Back to Top
Kendo UI is VS 2017 Ready