Open SoftCreatR opened 7 years ago
Could you try if https://github.com/khan4019/tree-grid-directive#expanding-tree-after-search fits your needs?
That isn't, what i am looking for (i already use it). It just defines, if parent nodes are expanded when searching for a child node but it.
Hmm... Ah, I think now I understand what you like to do: you want to display child nodes that don't match the current filter, but their parent do?
Without changing the code you could try following:
filterable
That should work. I used this "hack" for searching hidden data inside my nodes (had a title, short description, long description but only title was visible - but wanted to search all three)
Do you have an example? I'm not sure, if i understand that correctly or how that could work to achieve this.
displayName
of " " (a single space, if you leave it blank the name will be used!)cellTemplate
with an empty tag (span e.g.)filterable
should be true
...
tree_data = [
{ Name: "p1", filterMe: "Hello", filterMe2: "World", children: [ { Name: "c1", parentFilter: "Hello World", filterMe: "Foo", filterMe2: "Bar"}]
]
col_defs = {
...
{
field: "parentFilter",
displayName: " ",
filterable: true,
cellTemplate: "<span> </span>"
},
...
}
Hope you get the idea^^
Okay, that could be an idea. But it fails when having this:
{ Name: "p1", filterMe: "Hello", filterMe2: "World", filterMe3: "Boo", children: [ { Name: "c1", parentFilter: "Hello World", filterMe: "Foo", filterMe2: "Bar", filterMe3: "Baz"}]
When now searching for Boo
, children are are ommitted, because the parentFilter-property doesn't contain this word.
To make this work properly (without changing the directive), i would have to concat all parent properties into a single string and add it as new property to the children. Correct?
Yes, that would be the way to go.
Currently the search works as a filter for ng-repeat, so every node that doesn't fit the filter criteria is discarded - so will be the children in your case. Changing this behaviour would need a bigger rewrite...
Currently, nodes are shown until the matching node.
But if the matching node is a node with children, it appears to be expandable but it isn't. Nothing happens when clicking the expand icon. That's possibly some kind of a bug. However, displaying the children could be absolutely intended (as it is in my case, for example).
So i would ask you to implement the possibility to (optionally) display the children of a found parent node.