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

Style TreeView <li>

3 Answers 1216 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Walter
Top achievements
Rank 2
Walter asked on 19 Apr 2018, 09:36 PM

What is the best way to have all the red boxes (see pix) aligned to the right of the containing div? No success with floats or flexbox. Trying to mimic ClickOnce app in web SPA. Here's the app.component.sccs at the moment:

#treecontainer { width: 400px; border: 5px dotted black; overflow:hidden; }

div { border: 2px solid blue; }
span { border: 3px solid green; }
span:nth-of-type(3) {border: 3px solid red; float:right;}

3 Answers, 1 is accepted

Sort by
0
Walter
Top achievements
Rank 2
answered on 19 Apr 2018, 10:32 PM

https://jsfiddle.net/waltsully/uw1em4rn/ 

A little closer, now need to find the kendo class for the <li> 
I'm still open for suggestions.

0
Accepted
Dimiter Topalov
Telerik team
answered on 20 Apr 2018, 08:57 AM
Hi Walter,

The most straight-forward approach to right-align the mentioned span elements in the context of the TreeView, seems to utilize the component's templates to provide the desired markup for the nodes:

https://www.telerik.com/kendo-angular-ui/components/treeview/node-template/

... and use the following CSS rules to overwrite the built-in styling:

styles: [`
    >>> .k-treeview-lines .k-mid .k-in {
      width: 100%
    }
     
    >>> .k-treeview-lines .k-mid .k-in .custom-right {
      position: absolute;
      right: 5px;
    }
  `]

Here is a runnable example demonstrating the described approach:

https://plnkr.co/edit/GuO2OKORQyGIaxUPralE?p=preview

I hope this helps.

Regards,
Dimiter Topalov
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Walter
Top achievements
Rank 2
answered on 20 Apr 2018, 12:54 PM

Dimiter,

Awesome! Thanks for the elegant solution and fasssssssssssst response.  

 

:)

Tags
General Discussions
Asked by
Walter
Top achievements
Rank 2
Answers by
Walter
Top achievements
Rank 2
Dimiter Topalov
Telerik team
Share this question
or