Telerik Forums
Kendo UI for Angular Forum
1 answer
8 views

Hello everyone

I would like to persist the selection of columns in a kendo treelist, such that when a user reloads the page their selection of columns remains the same.

Is there a way of hooking into the events that take place when a selection is applied?

For example, in the picture attached, if the user were to select to display 'Description Two' and hit apply, then I would like for all three columns to be displayed on next reload. Likewise if a user were to hide both Description columns, then only the 'Name' column would be displayed on next reload. All three would still show up in the column chooser in this example, just that two of them would be turned off.

What might I do to achieve this in Angular15?

Best regards

Martin
Telerik team
 answered on 11 Apr 2024
1 answer
23 views

Hey guys,

I have an angular form that contains two tree lists: the first one is hierarchal and the 2nd is flat.  Both are populated using [kendoTreeListFlagBinding] and both render correctly.  The first tree list is hierarchal and the second is flat.  Yay Kendo!!

The issue is when I go to export from the flat treelist, it exports hierarchal and not flat.

First Treelist

 <kendo-treelist
            *ngIf="!this.isFlatList"
            [kendoTreeListFlatBinding]="ssAllowances"
            filterable="menu"
            [filter]="filter"
            (filterChange)="this.setFilter($event)"
            [sortable]="{ mode: 'multiple' }"
            [sort]="sort"
            kendoTreeListExpandable
            idField = 'currentGUID'  
            parentIdField='parentGUID'
            >
            <ng-template kendoTreeListToolbarTemplate>
              <button look="flat" type="button" class="btn"
                      title="Export to Excel" kendoTreeListExcelCommand>
                <i class="fa fa-lg fa-file-excel-o"></i>
              </button>
            </ng-template>

code for the column defs etc

 

second Treelist

 <kendo-treelist-column
              *ngIf="this.canDeleteAllowance()"
              width="25">
              <ng-template kendoTreeListCellTemplate let-dataItem #deleteButtonTemplate>
                <a *ngIf="dataItem.canDelete && dataItem.allowanceId !== 0"
                (click)="deleteAllowance(dataItem)"
                title="CLick to Delete">
                <i class="fa fa-trash"></i></a>
              </ng-template>
            </kendo-treelist-column>
            <kendo-treelist-excel fileName="ShipsetAllowances.xlsx"></kendo-treelist-excel>
          </kendo-treelist>

code for the column defs etc

 

What I need is the "directive" to tell excel to export the data as a flat list.

What am I missing from the doc

 

Thanx Kyle

 

 

Kyle
Top achievements
Rank 1
Iron
 answered on 05 Mar 2024
1 answer
23 views
Hi, we're currently using the TreeList and we've encountered an issue... while trying to edit a cell of a column named with a dot inside as "AR32.2" for example... the edit input doesn't show up

Could you help us with this case, please? :D 

Thank you,
Uscatu Cosmin

Zornitsa
Telerik team
 answered on 05 Feb 2024
0 answers
26 views

Hi, 

please help to set k-selected class on expand/collapse event in treeList (angular 16 app).

By default rows are highlighted on select event (k-selected class applied), but I need to highlight it on expand, collapse, select events.

I was trying to use rowCallback for setting/removing selected class and expand/collapse events for getting selected row id, but currently several rows are staying selected at the same time when should be selected only one (from the last action). Am I missing something, or is there a better approach?

rowCallback = (context) => {
return this.zone.run(() => {
if (context.dataItem.id === this.selectedNodeId) {
return {
'k-selected': true
}
}
else if (context.dataItem.id === this.previousSelectedNodeId) {
return {
'k-selected': false
}
}
});
}

onAction(e) {
this.zone.run(() => {
const row = this.treeList.view.data.find(dataItem => dataItem.data.id === e.dataItem.id);
if (row) {
this.previousSelectedNodeId = this.selectedNodeId;
this.selectedNodeId = row.data.id;
}
});

}

 

<kendo-treelist #treeList kendoTreeListExpandable kendoTreeListSelectable
[data]="(loadNodes$ | async)"
[fetchChildren]="fetchChildren"
[hasChildren]="hasChildren"
(selectionChange)="onSelectionChange($event)"
[rowClass]="rowCallback"
(expand)="onAction($event)"
(collapse)="onAction($event)">
Kyrylo
Top achievements
Rank 1
 asked on 05 Jan 2024
0 answers
43 views

<kendo-treelist
  class="kendo-treelist"
  [kendoTreeListFlatBinding]="data"
  #directive="kendoTreeListFlatBinding"
  [rowClass]="dynamicClass"
  [parentIdField]="parentIdField"
  [idField]="idField"
  kendoTreeListExpandable
  kendoTreeListSelectable
  [rowReorderable]="true"
  (cellClick)="onCellClick($event)"
  [itemKey]="idField"
  [(selectedItems)]="selected"
  [(expandedKeys)]="expandedIds"
  [isExpanded]="isExpanded"
  (expand)="onExpand($event)"
  (collapse)="onCollapse($event)"
  (rowReorder)="onRowReorder($event)"
  [loading]="data.length == 0"
  >
  <kendo-treelist-rowreorder-column [width]="25"></kendo-treelist-rowreorder-column>    
  <kendo-treelist-column
    *ngFor="let column of treeListOptions.columns" 
    [field]="column.field" 
    [expandable]="column.expandable" 
    [title]="column.title"  
    [width]="column.width">
    <ng-template *ngIf="column.ngTemplate" kendoTreeListCellTemplate let-dataItem let-rowIndex="rowIndex">
      <!-- Context values will be accessible for column customization on the parent component. -->
      <ng-container *ngTemplateOutlet="template; context: { dataItem, rowIndex, column }"></ng-container>
    </ng-template>
  </kendo-treelist-column>
</kendo-treelist>

Hi,

I am using Kendo Treelist Angular with 'kendoTreeListFlatBinding'. Mock data is also attached. There could be multiple folders and each folder can have multiple templates in it. I want to use row-reorder on my tree-list component.

After enabling rowreorder. I have following scenarios to deal with:

  1. Template is reordered within the same Folder - Positions of all templates will be changed in this case. 
  2. Template is reordered into some other Folder - Parent id of dragged template and Positions of all templates in target folder will be changed.
  3. Folder is reordered into some other Folder - parent id of dragged template and its child templates will change and Positions of all templates in target folder will be changed.  
Now this can be handled through some custom logic. And templates can be saved to DB with new positions and parent-ids.
But I want to know, if Kendo Treelist provides any build-in event or mechanism through which these changed positions can be handled/accessed and can be sent to backend to save changes in DB afterwords.

Attaching few screenshots and mock data to help you understand the issue. 
ankit
Top achievements
Rank 1
 asked on 03 Jan 2024
1 answer
51 views

In our application we are using angular 14 and the kendo control  tree-list , our requirement is to set the focus on the next node after we delete any node . Is there any possible method or way out to set focus.

For example If we delete "BW Input Template" then focus should be set on "Report Template" (there can be any number of node in BW Input Template folder ) and same for any node within the folder if deleted then focus should set to next node within the folder also I need the  focused node data.

 

 

The code sample and data is below

<kendo-treelist
  class="kendo-treelist"
  [kendoTreeListFlatBinding]="data"
  #directive="kendoTreeListFlatBinding"
  parentIdField="wrkdocParentoid"
  idField="wrkdocOid"
  kendoTreeListExpandable
  kendoTreeListSelectable
  [height]="1200"
  [rowReorderable]="true"
  (cellClick)="onCellClick($event)"
>
  <kendo-treelist-rowreorder-column
    [width]="25"
  >
  </kendo-treelist-rowreorder-column>
  <kendo-treelist-column 
    [expandable]="true" 
    title="Name" 
    [width]="250"
  >
    <ng-template 
      kendoTreeListCellTemplate let-dataItem let-rowIndex="rowIndex"
    >
      <span class="k-icon k-i-folder" *ngIf="isFolder(dataItem)"></span>
      <span> {{ getTemplateName(dataItem) }}</span>
    </ng-template>
  </kendo-treelist-column>
  <kendo-treelist-column
    field="wrkdocUdid"
    title="ID"
    [width]="140"
  ></kendo-treelist-column>
</kendo-treelist>

 

DATA set:

mockData: any[] = [
  {
    wrkdocOid: 3,
    wrkdocType: 'RootTemplateContainer',
    wrkdocUdid: 'BuiltIn.RootContainer',
    wrkdocDescription:
      'an invisible built-in folder which contains all items that appear on the root level',
    wrkdocUpdatedate: null,
    wrkdocUpdatename: null,
    wrkdocWrkxlsoid: null,
    wrkdocParentoid: null,
    wrkdocPosition: null,
    wrkdocXmlfile: null,
    fmwrkdoclans: [],
    inverseWrkdocParento: [],
    wrkdocParento: null,
  },
  {
    wrkdocOid: 4,
    wrkdocType: 'UnusedTemplateContainer',
    wrkdocUdid: 'BuiltIn.UnusedContainer',
    wrkdocDescription:
      'an invisible built-in folder which contains all items that appear in the not-used list',
    wrkdocUpdatedate: null,
    wrkdocUpdatename: null,
    wrkdocWrkxlsoid: null,
    wrkdocParentoid: null,
    wrkdocPosition: 1,
    wrkdocXmlfile: null,
    fmwrkdoclans: [],
    inverseWrkdocParento: [],
    wrkdocParento: null,
  },
  {
    wrkdocOid: 5,
    wrkdocType: 'Folder',
    wrkdocUdid: 'BwTemplates',
    wrkdocDescription: null,
    wrkdocUpdatedate: '2010-03-03T09:42:15',
    wrkdocUpdatename: null,
    wrkdocWrkxlsoid: null,
    wrkdocParentoid: 3,
    wrkdocPosition: 0,
    wrkdocXmlfile: null,
    fmwrkdoclans: [],
    inverseWrkdocParento: [],
    wrkdocParento: null,
  },
  {
    wrkdocOid: 52,
    wrkdocType: 'Folder',
    wrkdocUdid: 'BwIT100',
    wrkdocDescription: null,
    wrkdocUpdatedate: '2010-03-17T13:55:12',
    wrkdocUpdatename: 'Basware system',
    wrkdocWrkxlsoid: null,
    wrkdocParentoid: 5,
    wrkdocPosition: 0,
    wrkdocXmlfile: null,
    fmwrkdoclans: [
      {
        wrkdoclanWrkdocoid: 52,
        wrkdoclanText: 'BW Input Templates',
        wrkdoclanLanudid: 'EN',
        wrkdoclanWrkdoco: null,
      },
      {
        wrkdoclanWrkdocoid: 52,
        wrkdoclanText: 'BW Syöttöpohjat',
        wrkdoclanLanudid: 'FI',
        wrkdoclanWrkdoco: null,
      },
    ],
    inverseWrkdocParento: [],
    wrkdocParento: null,
  },
 
  {

  {
    wrkdocOid: 10200,
    wrkdocType: 'Template',
    wrkdocUdid: 'E_104',
    wrkdocDescription: null,
    wrkdocUpdatedate: '2023-01-13T12:56:10',
    wrkdocUpdatename: 'Latvanen Henri',
    wrkdocWrkxlsoid: 10124,
    wrkdocParentoid: 4,
    wrkdocPosition: 0,
    wrkdocXmlfile: 20241,
    fmwrkdoclans: [
      {
        wrkdoclanWrkdocoid: 10200,
        wrkdoclanText: 'laskelma',
        wrkdoclanLanudid: 'EN',
        wrkdoclanWrkdoco: null,
      },
      {
        wrkdoclanWrkdocoid: 10200,
        wrkdoclanText: 'laskelma',
        wrkdoclanLanudid: 'FI',
        wrkdoclanWrkdoco: null,
      },
    ],
    inverseWrkdocParento: [],
    wrkdocParento: null,
  },
];
Martin
Telerik team
 answered on 14 Nov 2023
0 answers
102 views

In our application we are using angular 14 and the kendo control  tree-list , our requirement is to hide the parent node(Root container, unsedContainer) as you can see in the attached image. We want to display the child node only. Is there is any way out or property by which we can hide the root node.

 image

The code sample and data is below

<kendo-treelist
  class="kendo-treelist"
  [kendoTreeListFlatBinding]="data"
  #directive="kendoTreeListFlatBinding"
  parentIdField="wrkdocParentoid"
  idField="wrkdocOid"
  kendoTreeListExpandable
  kendoTreeListSelectable
  [height]="1200"
  [rowReorderable]="true"
  (cellClick)="onCellClick($event)"
>
  <kendo-treelist-rowreorder-column
    [width]="25"
  >
  </kendo-treelist-rowreorder-column>
  <kendo-treelist-column 
    [expandable]="true" 
    title="Name" 
    [width]="250"
  >
    <ng-template 
      kendoTreeListCellTemplate let-dataItem let-rowIndex="rowIndex"
    >
      <span class="k-icon k-i-folder" *ngIf="isFolder(dataItem)"></span>
      <span> {{ getTemplateName(dataItem) }}</span>
    </ng-template>
  </kendo-treelist-column>
  <kendo-treelist-column
    field="wrkdocUdid"
    title="ID"
    [width]="140"
  ></kendo-treelist-column>
</kendo-treelist>

 

DATA set:

mockData: any[] = [
  {
    wrkdocOid: 3,
    wrkdocType: 'RootTemplateContainer',
    wrkdocUdid: 'BuiltIn.RootContainer',
    wrkdocDescription:
      'an invisible built-in folder which contains all items that appear on the root level',
    wrkdocUpdatedate: null,
    wrkdocUpdatename: null,
    wrkdocWrkxlsoid: null,
    wrkdocParentoid: null,
    wrkdocPosition: null,
    wrkdocXmlfile: null,
    fmwrkdoclans: [],
    inverseWrkdocParento: [],
    wrkdocParento: null,
  },
  {
    wrkdocOid: 4,
    wrkdocType: 'UnusedTemplateContainer',
    wrkdocUdid: 'BuiltIn.UnusedContainer',
    wrkdocDescription:
      'an invisible built-in folder which contains all items that appear in the not-used list',
    wrkdocUpdatedate: null,
    wrkdocUpdatename: null,
    wrkdocWrkxlsoid: null,
    wrkdocParentoid: null,
    wrkdocPosition: 1,
    wrkdocXmlfile: null,
    fmwrkdoclans: [],
    inverseWrkdocParento: [],
    wrkdocParento: null,
  },
  {
    wrkdocOid: 5,
    wrkdocType: 'Folder',
    wrkdocUdid: 'BwTemplates',
    wrkdocDescription: null,
    wrkdocUpdatedate: '2010-03-03T09:42:15',
    wrkdocUpdatename: null,
    wrkdocWrkxlsoid: null,
    wrkdocParentoid: 3,
    wrkdocPosition: 0,
    wrkdocXmlfile: null,
    fmwrkdoclans: [],
    inverseWrkdocParento: [],
    wrkdocParento: null,
  },
  {
    wrkdocOid: 52,
    wrkdocType: 'Folder',
    wrkdocUdid: 'BwIT100',
    wrkdocDescription: null,
    wrkdocUpdatedate: '2010-03-17T13:55:12',
    wrkdocUpdatename: 'Basware system',
    wrkdocWrkxlsoid: null,
    wrkdocParentoid: 5,
    wrkdocPosition: 0,
    wrkdocXmlfile: null,
    fmwrkdoclans: [
      {
        wrkdoclanWrkdocoid: 52,
        wrkdoclanText: 'BW Input Templates',
        wrkdoclanLanudid: 'EN',
        wrkdoclanWrkdoco: null,
      },
      {
        wrkdoclanWrkdocoid: 52,
        wrkdoclanText: 'BW Syöttöpohjat',
        wrkdoclanLanudid: 'FI',
        wrkdoclanWrkdoco: null,
      },
    ],
    inverseWrkdocParento: [],
    wrkdocParento: null,
  },
 
  {

  {
    wrkdocOid: 10200,
    wrkdocType: 'Template',
    wrkdocUdid: 'E_104',
    wrkdocDescription: null,
    wrkdocUpdatedate: '2023-01-13T12:56:10',
    wrkdocUpdatename: 'Latvanen Henri',
    wrkdocWrkxlsoid: 10124,
    wrkdocParentoid: 4,
    wrkdocPosition: 0,
    wrkdocXmlfile: 20241,
    fmwrkdoclans: [
      {
        wrkdoclanWrkdocoid: 10200,
        wrkdoclanText: 'laskelma',
        wrkdoclanLanudid: 'EN',
        wrkdoclanWrkdoco: null,
      },
      {
        wrkdoclanWrkdocoid: 10200,
        wrkdoclanText: 'laskelma',
        wrkdoclanLanudid: 'FI',
        wrkdoclanWrkdoco: null,
      },
    ],
    inverseWrkdocParento: [],
    wrkdocParento: null,
  },
];
Johina
Top achievements
Rank 1
 updated question on 19 Oct 2023
1 answer
76 views

Hello,

Does the TreeList component support server-side pagination?

It seems that the only way to use pagination with the TreeList component is to fetch all the parent nodes from the remote resource and then the component can apply paging to them in memory. Is this correct, or can the parent nodes be paginated server-side in a similar fashion to items with the Grid component? And if so, how would one go about doing this?

Our use case involves a two-level hierarchy, where there may be tens of thousands of parent nodes, so only being able to fetch the child nodes on demand isn't quite enough to limit the amount of data loaded at once, hence our need to paginate the parent nodes.

Thank you.


Yanmario
Telerik team
 answered on 07 Sep 2023
0 answers
45 views

Hi,
I am making a standard treelist component based on kendo treelist, and im having some problem which i dont know how to fix it. 
2. I want to allow user can add kendo treelist column and use ng-template KendoTreelistCell as `Usage code` below but it keep throw this error:
Uncaught (in promise): NullInjectorError: R3InjectorError(PMarketingModule)[OptionChangesService -> OptionChangesService -> OptionChangesService -> OptionChangesService]: 
  NullInjectorError: No provider for OptionChangesService!
NullInjectorError: R3InjectorError(PMarketingModule)[OptionChangesService -> OptionChangesService -> OptionChangesService -> OptionChangesService]: 
 NullInjectorError: No provider for OptionChangesService!
https://stackblitz.com/edit/angular-keazja?file=src%2Fapp%2Fapp.component.ts
My component treelist:

export class PKendoTreelistComponent<T> implements OnInit, AfterViewInit {
  //Retrive input with many type of input array
  @Input() rootData: Subject<T[]> = new Subject<T[]>();
  @Input() hasChildrenFn: (item: T) => boolean;
  @Input() fetchChildrenFn: (item: T) => T[];
  @ViewChild('customTreeList') public customTreelist: TreeListComponent;
  @ViewChild('treelistContent', { static: true }) treelistContent!: TemplateRef<any>;
  @ContentChildren(PKendoTreeListColumnComponent) columns;
  @ContentChildren(ColumnGroupComponent) columnGroups;
  constructor() {}
  ngOnInit(): void {
    console.log(this.treelistContent);
  }
  ngAfterViewInit(): void {
      this.customTreelist.columns.reset([
        this.customTreelist.columns.toArray()[0],
        this.columnGroups.toArray(),
        this.customTreelist.columns.toArray().slice(1)
      ])
  }
}
<kendo-treelist
    #customTreeList
    kendoTreeListExpandable
    [data]="rootData | async"
    [fetchChildren]="fetchChildrenFn"
    [hasChildren]="hasChildrenFn"
    [height]="400"
    >
    <ng-content></ng-content>
</kendo-treelist>


@Component({
  selector: 'app-p-kendo-treelist-column',
  template: `<kendo-treelist-column
  #CustomTreelistColumn
  [field]="field"
  [title]="title"
  [width]="width"
  [expandable]="expandable"
  >
</kendo-treelist-column>`
})
export class PKendoTreeListColumnComponent {
  @ViewChild(ColumnComponent) public realColumn: ColumnComponent;
  @Input() field: string = '';
  @Input() title: string = '';
  @Input() width: number = 0;
  @Input() expandable: boolean = false;
  constructor() { }
  ngAfterViewInit() {
    console.log(this.realColumn)
  }
}



Usage:

      <app-p-kendo-treelist
      [rootData]="listGroupWebTreeList"
      [hasChildrenFn]="hasChildren"
      [fetchChildrenFn]="fetchChildren"
    >
      <kendo-treelist-column [expandable]="true" class="d-flex">
        <ng-template kendoTreeListCellTemplate let-dataItem>
          {{dataItem.VNGroupName}}
        </ng-template>
      </kendo-treelist-column>
      </app-p-kendo-treelist>


Regards,
Hnaul

Huynh
Top achievements
Rank 1
 updated question on 19 Jul 2023
0 answers
48 views

Hi Members,

I have been trying to achieve drag and drop between Kendo Grid to Kendo Tree and vice versa but unable to find a feasible solution.

Is it possible to do so, if yes then can you please let me share some example of if someone has implemented something similar.

By default i think it doesn't support dragging and dropping from Kendo Angular Tree Control to Kendo Angular Grid Control

Anas
Top achievements
Rank 1
 asked on 03 Jul 2023
Top users last month
Dominik
Top achievements
Rank 1
Giuliano
Top achievements
Rank 1
Dominic
Top achievements
Rank 1
Glendys
Top achievements
Rank 1
Iron
NoobMaster
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?