This is a migrated thread and some comments may be shown as answers.

How does the dataDateField work?

1 Answer 64 Views
Timeline
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Veteran
Ryan asked on 17 Mar 2021, 07:46 AM

Attempting w/o success to leverage timeline against existing data. Having difficulty getting it to work..Below is the stock example on the site with the date property in the array changed to 'date1'.. Added the dataDateField; 'date1' to account for the change.  Also tried altering the schema in the datasource.. 

$("#timeline").kendoTimeline({
    dataSource: {
        data: [
        { "id": 1, "title": "Bowling tournament", "subtitle": "Location: Sterling Lanes", "description": "Summer Bowling tournament in Michigan", "date1": "2025-06-30T21:00:00.000Z", "actions": [{ "text": "Visit the Bowling tournament page" }] },
        { "id": 2, "title": "Charlie's first football game", "subtitle": "Location: City Football Stadium", "description": "Call coach Williams", "date1": "2022-10-22T21:00:00.000Z" },
        { "id": 3, "title": "Alex's Birthday", "subtitle": "Location: Alex's House", "description": "Buy birthday cake and some fruits", "date1": "2010-01-09T22:00:00.000Z", "images": [{ "src": "https://demos.telerik.com/kendo-ui/content/web/foods/4.jpg" }, { "src": "https://demos.telerik.com/kendo-ui/content/web/foods/16.jpg" }] },
        { "id": 4, "title": "Vacation in Mexico", "subtitle": "Location: Cabo San Lucas", "description": "Check-in for the flight", "date1": "2017-12-24T22:00:00.000Z" }]
    },
    dataDateField: 'date1',
    orientation: "vertical"
});

1 Answer, 1 is accepted

Sort by
0
Mihaela
Telerik team
answered on 19 Mar 2021, 02:58 PM

Hi Ryan,

Thank you for sharing the screenshots.

Basically, the "dataDateField" option is used to let the Kendo UI Timeline which property should be used for building the timeline. It is mandatory to specify the data type of the field in the schema of the data source. 

Therefore, you should update the schema as follows:

$("#timeline").kendoTimeline({
    dataSource: {
      data: dataArray,
      schema: {
        model: {
          fields: {
            date1: {
              type: "date"
            }
          }
        }
      }
    },
  dataDateField:"date1",
  orientation: "vertical"
});

Here is a runnable Dojo example for your reference:

https://dojo.telerik.com/aPETadob/2

Let me know if you have any other queries and I would be happy to assist.

 

Regards, Mihaela Lukanova Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Timeline
Asked by
Ryan
Top achievements
Rank 1
Veteran
Answers by
Mihaela
Telerik team
Share this question
or