Treelist Rowreorder - After rowreorder, can we get Treelist state with changed positions and parent-ids

0 Answers 113 Views
TreeList
ankit
Top achievements
Rank 1
ankit asked on 03 Jan 2024, 09:55 AM

<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. 

No answers yet. Maybe you can help?

Tags
TreeList
Asked by
ankit
Top achievements
Rank 1
Share this question
or