dgrid
dgrid copied to clipboard
Tree#expand behaves indistinguishably for unrendered-but-existing IDs and nonexistent IDs
When Tree
is used with a lazy-rendering grid (which is the norm, e.g. OnDemandGrid
or Pagination
), the expand
method will currently end up throwing an error if an item ID is passed that is not currently rendered - whether it actually exists in the store or not. This is admittedly a likely rare case (compared to the usual case of expand
being called as a result of direct user interaction on a row that is already rendered), but could lead to confusion.
I see 3 possible ways of addressing this:
- Keep the current behavior (potentially confusing)
- In the absence of a row element, call the collection's
get
method (potentially expensive for a server-side store, but again, this is a relatively rare case), then only reject if that returns nothing or throws - Always modify the
_expanded
hash, regardless of whether the item will ever be rendered (potentially wasteful if used excessively)