Trying to figure out if there is a way to pick if the items will be on the left or right, i dont want to alternate but rather pick which ones will be on each side. If anyone knows how and could pass on the info that would be great!
1 Answer, 1 is accepted
0
Alexander
Telerik team
answered on 17 Feb 2022, 11:06 AM
Hi Joseph,
I noticed that there is not a Telerik UI for ASP.NET Core license associated with your account which limits the availability of our support services for the product. In this regard, It is recommended that you either purchase or renew your license in order to gain access to the latest updates, fixes, features, and support regarding the Telerik UI for ASP.NET Core components. More information regarding the currently available plans can be found in the Support Plans section.
With that said, currently, the Telerik UI for ASP.NET Core Timeline does not expose a built-in configuration that allows a left or right positioning for a particular Timeline event.
Having this in mind, you achieve the desired result using the following approach:
Add a boolean property to the Model of the Timeline that would indicate whether a particular timeline event will be displayed on the left or right. For example:
Get the unique identifier for the currently rendered list item and add or remove the "k-reverse" class generated for the position of the current list item based on the state isLeft field mentioned previously.
Update the card callout classes as well, in order to ensure proper stylization regarding the cards.
functiononDataBound(){
var items=this.dataSource.data();
for(var i = 0; i < items.length; i++){
var item = items[i];
var uidAttr = kendo.attr('uid');
var element = this.element.find('li[' + uidAttr + '=' + item.uid + ']');
var isLeft = item.isLeft;
element.toggleClass("k-reverse", isLeft);
element.find('.k-card-callout')
.toggleClass('k-callout-e', isLeft)
.toggleClass('k-callout-w', !isLeft);
}
}