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

need to have multiple columns aligned in treeview

1 Answer 799 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jennifer
Top achievements
Rank 1
Jennifer asked on 06 Nov 2018, 07:21 PM

I have a treeview working with multiple columns but I need the buttons in those columns to be aligned.  The jquery example found here: https://www.telerik.com/forums/treeview-with-columns-in-node

was helpful but it relies on the data containing the row level information.  I don't want to have to add and maintain that in my datastructure.  Is there another way to do it.

 

Here is my code:

@Component({
    selector: 'app-treeview',
    template: `
    <kendo-treeview
    [nodes]="treeNodes"
    [isExpanded]=""
    textField="Text"

    kendoTreeViewExpandable

    kendoTreeViewFlatDataBinding
    idField="Ordinal"
    parentIdField="OrderNumber">
    <ng-template kendoTreeViewNodeTemplate let-dataItem>
   <div style="width:1500px;">
      <div style="display: inline-block;width:40%">
        {{dataItem.Text}}
      </div>
      <div style="display:inline; width:30%;">
      <button class="btn btn-primary">{{dataItem.NRName}}</button>

      </div>
      <div style="display:inline; width:30%; ">
        <button class="btn btn-primary">{{dataItem.RECName}}</button>
      </div>
   </div>
    </ng-template>
  </kendo-treeview>

  `
})

 

Any suggestions are appreciated.

1 Answer, 1 is accepted

Sort by
0
Svet
Telerik team
answered on 08 Nov 2018, 08:05 AM
Hi Jennifer,

We can rely on the number of levels of each node. In the provided example, we can apply a custom CSS class, using Angular's ngClass, only if there are no more child nodes of the specific node. Check the following example demonstrating this approach:
https://stackblitz.com/edit/angular-w1nc9v?file=app/app.component.ts

I hope this helps.

Regards,
Svetlin
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
General Discussions
Asked by
Jennifer
Top achievements
Rank 1
Answers by
Svet
Telerik team
Share this question
or