arnedesmedt / vue-ads-table-tree

MIT License
125 stars 30 forks source link

Documentation for call-temp-rows #19

Open klassm opened 5 years ago

klassm commented 5 years ago

Hi,

I am trying to switch my vue-ads-table-tree implementation towards async loading. Everything works fine by now - except filtering rows using call-temp-rows. What I'd like to have is the same filtering as without async loading - so searching in the whole tree for matching elements and showing the results in the tree structure (if the child matches, the parent should also be displayed).

Unfortunately, there is no example showing this use case. When I try to implement that case, I'd return some _children elements. However, those children elements are not shown, unless I set _hasChildren to be true. However, then vue-ads-table-tree crashes, as no _meta element is set: TypeError: Cannot set property 'groupParent' of undefined

I can also set this one - which makes everything work, except that child elements are not being expanded and that the rest of the parent data is wrong afterwards (like indentation of elements is wrong).

When also setting _showChildren vue-ads seems to go into an endless loop, crashing chrome.

Can you provide a working example on how to implement this? I guess I am just doing something wrong here ...

Matthias

klassm commented 5 years ago

Seems like the problem with Chrome getting stuck was an issue of rendering too slow / too much at once. Once resolving this I can now also set showChildren to true and see results. So now I got a working implementation. However, I guess it is not how you intended it, as I now use the _meta object quite heavily.

On every child I now set:

            _children: matchingChildren,
            _hasChildren: matchingChildren.length > 0,
            _showChildren: true,
            _meta: {visibleChildren: matchingChildren, parent: level, groupParent: level}
arnedesmedt commented 5 years ago

Hi, I'll try to implement an example when I find some spare time :wink: