Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The reason why <code>AddChild()</code> is not encouraged is that it breaks the virtual paradigm of the component - you create all the nodes, even though you may never need them. Say the query returns 100 records but the tree shows 10 nodes at the time. Now if the user nevers scrolls down you have wasted resources for 90 nodes as they are never needed (don't became visible). So if you're worried about memory usage, <code>AddChild()</code> is bad idea. Another thing is that if the resultset is big, populating the tree takes time and your app isn't responsive at that time. When using virtual way (<code>RootNodeCount</code> and <code>OnInitNode</code>) the tree is "ready" immediately and user doesn't experience any delay.</p> <p>Then again, in case of (relatively) small resultsets using <code>AddChild()</code> might be the best option - it would allow you to load data in one short transaction. Ie in case of tree structure it would make sense to load whole "level" at once when user expands the parent node.</p> <p>Using DB with VT is a bit tricky as the DB query is special resource too, with it's own constraints (you want to keep transactions short, it is relatively slow, the DB might only support one way cursor etc). <br> So I'd say it is something you have to decide on each individual case, depending on the use case and amount of data, ie</p> <ul> <li>small resultset is OK to load all at once with <code>AddChild()</code> or into internal data structure and then using it throught VT's events;</li> <li>loading one level at time is probably good compromise for trees;</li> <li>in case of very large resultsets loading in batches might give good perfomance and memory usage compromise but adds complexity to the code managing VT.</li> </ul>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload