jQWidgets Forums

jQuery UI Widgets Forums Angular TreeItem missing level property

Tagged: 

This topic contains 3 replies, has 2 voices, and was last updated by  Peter Stoev 7 years, 10 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • TreeItem missing level property #94938

    MattB
    Participant

    It appears that the TreeItem interface in jqWidgets.d.ts is missing the level property. Is this by design?

    export interface TreeItem {
    // TreeItem properties
    label?: string;
    value?: string;
    disabled?: boolean;
    checked?: boolean;
    element?: any;
    parentElement?: any;
    isExpanded?: boolean;
    selected?: boolean;
    level?: number;
    }// TreeItem

    TreeItem missing level property #94944

    Peter Stoev
    Keymaster

    It never had level property.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    TreeItem missing level property #94974

    MattB
    Participant

    I have an AngularJS app that has script:
    var itms = $scope.tree.getItems();
    var lst = [];
    for (i = 0; i < itms.length; i++) {
    var item = {
    level: itms[i].level,
    value: itms[i].value
    };
    lst.push(item);
    }

    In my Angular 2 project I have the same thing.
    let itms = this.tree.getItems();
    let lst: any = [];
    for (let i = 0; i < itms.length; i++) {
    let item = {
    level: itms[i].level,
    value: itms[i].value
    };
    lst.push(item);
    };
    In VS2017, this does not work because the compiler does not recognize the level property. It does work if you add level to the treeitem interface. You can also see the level property if you send itms[i] to the console.

    What is the proper way to get the item’s tree level?

    TreeItem missing level property #94977

    Peter Stoev
    Keymaster

    It is private propery for the Tree and is not supposed to be used by end users. There is no proper way for getting it in general.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.