Search code examples
javascriptjsonkendo-uikendo-schedulerkendo-datasource

How can I show custom events on Kendo UI Scheduler?


I have a Kendo UI Scheduler with a timeline view in which as one of the resources, a list of Persons names are being dynamically populated in the Scheduler. To get that data, I created a remote webservice responsible to get a proper communication between the database and the front-end. When I created the web service, I also created a method called GetPersons in VB that retrieves me the data in JSON format for me to use.

resources: [{
       field: "UserID",
       name: "Persons",
       dataTextField: "Name",
       dataValueField: "Name",
       dataSource: new kendo.data.DataSource({
          transport: {
             read: {
                url: 'Service/JSON/GetPersons'
             },
          schema: {
             type: "json",
             data: "GetPersonsResult.RootResults"
             }
          }
       ),
       multiple: true,
    title: "name"

Now, to explain my issue:

  • I have a table on the database with the following fields: ID, PersonID, TypeOfEventID, startDate and endDate. In this table, I created three events just to try testing and to be related with the Persons.

  • I am trying to see in the Scheduler all those events I created but so far, nothing shows up. My logic was the same as with the GetPersons method. I created a new VB file called GetEvents to get me the events in the web service from the database to be retrieved and used in JSON format later. With this JSON data, I was planning to see the events I created. Just like it happend with the GetPersons method.

  • The view used it's a custom one based on the timelineMonth type. Every row has a different Person name and for each Person, specific events of different types might be seen.

Here's a fiddle with my script

So far, I can not see any events neither the Scheduler pop-window that shows up when I do double click inside the Scheduler.

Any tip of how to associate all these sort of things? I have no idea if I need to create another dataSource, neither I know what to put exactly on the resources and/or schema/model section.


Solution

  • One month after, nobody answered to my question and because of this I believe that I should post the solution:

    • The main thing that I had to do, was to create my second type of resources in a proper way. So, very simply... I did this:

      { field: "EventType", dataValueField: "EventTypeID", dataTextField: "descr", dataColorField: "Color", dataSource: new kendo.data.DataSource({ transport: { read: { url: './../Services/BlahBlahBlahDomainService.svc/JSON/GetEventType' } }, schema: { type: "json", data: "GetEventsTypeResult.RootResults", total: "GetEventsTypeResult.TotalCount" } } ) }

    Besides that, I discovered some other little issues. For example:

    • the editable option was disabled;
    • both resources dataSource had no "schema.total" field defined and that options is needeed once the "schema.data" field is called;
    • a "dataTextField" property from one of the resources was missed;