wj-tree-view refresh item header

Posted by: patrick.maurer on 19 September 2017, 11:15 am EST

  • Posted 19 September 2017, 11:15 am EST

    I have an array of items with header property:


    export interface TreeItem {
    header: string;
    tag: ModelItem;
    childNodes: Array<TreeItem>;
    }


    The tree view binds to a property with an array of the above TreeItem:

    <wj-tree-view
    name="myProp"
    [wjModelProperty]="'itemsSource'"
    [ngModel]="rootItems"
    childItemsPath="childNodes"
    displayMemberPath="header"
    (formatItem)="onFormatItem($event)"
    (loadedItems)="onLoadedItems()"
    [(selectedItem)]="selectedItem"
    [allowDragging]="true"
    (dragOver)="onDragOver($event)"
    (drop)="onDrop($event)"
    [autoCollapse]="false"
    [isAnimated]="false">
    </wj-tree-view>


    The header text (coming from the ModelItem in the first place) is updated after the wj-tree-view was built. This change is not reflected in the UI, I still see the old text.

    How can the tree view be updated if the underlaying data changes?
  • Replied 21 September 2017, 10:09 am EST

    Any news on this topic?
  • Replied 22 September 2017, 1:23 am EST

    Hi, Patric,
    We are sorry, we are unable to replicate the issue at our end. Please refer to the plunker[1] that depicts the same.

    Thanks,
    Manish Kumar Gupta

    [1] http://plnkr.co/edit/TgsVah?p=preview
  • Replied 22 September 2017, 3:06 am EST

    Hi Manish,

    thank you for the plunker. I can see how it is possible to update the header binding, so that it points to a different property.

    I created a fork to demonstrate the behavior I hoped to see:

    http://plnkr.co/edit/JbWICwwKLKb8N6xNrIRu?p=preview

    Is it possible somehow?

    Thanks
  • Replied 26 September 2017, 1:48 am EST

    Hi Patrick,
    You need to set itemsSource to empty array and assign back to TreeView. Please refer to the updated plunker:
    http://plnkr.co/edit/zGEzyYXrG12wqNMAMlWz?p=preview

    Thanks,
    Manish Kumar Gupta
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels