EasyUI Forum

General Category => EasyUI for Angular => Topic started by: jimbo on January 01, 2019, 11:26:47 PM



Title: Tree still show loading icon in case node doesn't have any children ?
Post by: jimbo on January 01, 2019, 11:26:47 PM
i using Tree component with lazy-load, everything looks good, but in case a node does not have any children and result is empty, the loading icon does not disappear, So I did something wrong or this is an issue of component ?

Code:
onNodeExpand(event){
        let node = event;
        if (!node.children) {
            this.dataService.getNodes(node).subscribe((data) => node.children = data);
            // data = [] when this node doesn't have any child
        }
 }


Title: Re: Tree still show loading icon in case node doesn't have any children ?
Post by: stworthy on January 01, 2019, 11:56:23 PM
If a node hasn't any children, its state can't be set to 'closed'. It will be a leaf node.


Title: Re: Tree still show loading icon in case node doesn't have any children ?
Post by: jimbo on January 14, 2019, 09:34:40 PM
If a node hasn't any children, its state can't be set to 'closed'. It will be a leaf node.
But i using lazy load,so don't know if this node have childs or not


Title: Re: Tree still show loading icon in case node doesn't have any children ?
Post by: stworthy on January 15, 2019, 06:14:27 PM
In your server side you should determine which node has children and then set its 'state' property to 'closed'.