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

Timeline - Vertical - Reverse Chronological order

2 Answers 301 Views
Timeline
This is a migrated thread and some comments may be shown as answers.
Barry
Top achievements
Rank 1
Barry asked on 05 Feb 2020, 04:28 PM

How can I get the timeline control to show events in reverse chronological order, I am using the control to show a vertical timeline but would like the most recent dates to appear at the top, I tried the obvious things like reversing the order of the items in the data I was sending to the control but it seems to make no difference.

Hopefully I am just missing something obvious!

Regards

 

Barry Compuesto

2 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 10 Feb 2020, 12:14 PM

Hi Barry,

It is possible to sort the Timeline by using the data source sort configuration. It is important to define the date field in the schema so the data source works with the correct type. Here is an example configuration:

- The Timeline declaration:

    @(Html.Kendo().Timeline<Kendo.Mvc.Examples.Models.TimelineEventModel>()
               .Name("Timeline")
               .DataDateField("EventDate")
               .Orientation(TimelineOrientation.Vertical)
               .CollapsibleEvents()
               .DataSource("ds")
    )

- The DataSource declaration:

<script>
    var ds = new kendo.data.DataSource({
        transport: {
            read: {
                url: "Umbraco/Surface/Home/DisplayTimeLine",  // the URL to which the request is sent.
                dataType: "json",
            }
        },
        sort: {
            field: "EventDate", dir: "desc"
        },
        schema: {
            model: {
                fields: {
                    EventDate: {
                        type: "date"
                    },
                }
            }
        }
    })
</script>

The above could be observed in the following Dojo demo. Please note that it uses Kendo UI for jQuery implementation but the logic remains the same for ASP.NET Core projects:

Please try the above and let me know if you have any questions.

Regards,
Nikolay
Progress Telerik

Get quickly onboarded and successful with Telerik UI for ASP.NET Core with the dedicated Virtual Classroom technical training, available to all active customers.
0
Amber
Top achievements
Rank 1
answered on 06 May 2020, 01:06 PM
This is exactly what I needed. Thank you.
Tags
Timeline
Asked by
Barry
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Amber
Top achievements
Rank 1
Share this question
or