Open ahmed-abdulmoniem opened 7 years ago
There's no explicit option to set this but you may implement it as part of your template.
In your template you have access to depth
, trw.root()
and trvw.isVisible(node)
. You may show your "No results" message if none of the root notes are visible (trvw.root()
may return a single node or an array of nodes depending on how you set up your treeview). depth
may just be handy so you aren't performing too many redundant is there data? checks.
How can I access depth
? Is there any doc on how to use trvw
?
Yep, this section of the docs talks about the scope variables provided to your template and how to use them: https://github.com/iVantage/angular-ivh-treeview/blob/master/docs/templates-and-skins.md#supported-template-scope-variables
Thanks.
OK the problem now is that I am showing a list of nodes without any parent node .. just a list of nodes representing a list of categories.
How can I achieve "No results" message then?
trvw.root()
should give you that array of top level categories. I'd probably create a small "No results" directive and pass it whatever trvw.root()
spits out (+ depth
or something). The no results directive could display text if none of the categories are visible.
If that's not very clear I'd be happy to take a look at some code but would you mind posting on Stack Overflow? You can drop a link here to the SO question here.
Sorry I don't get you.
When I use trvw.root().length
I always get 20 = number of categories even if there is no one shown in the list!
The nodes are always there just not always visible. You'll want to filter that list using trvw.isVisible.
ah! OK I will check then and get back to you.
Can I use this trvw.isVisible(Object node)
inside a .js
file not in the template?
Also, using template doesn't help because it is a template of each node and I want to show the message only one time per the whole tree not under each node. And when the nodes are not visible nothing will be shown!
Hi,
If after the filter is applied to the nodes, there are no nodes are shown I want to - instead of just empty div or panel - show a message "No results".
Is that possible?
Thanks.