## MUST

Restore support for complex IDs

## CAN

Implement batch API

Flat sorting view option
- Pass all parents to renderRow
- Demo showing parents in PickerItem's subtitle

Editable table demo

.reload() method

call clearCache() on picker close

Better loading UX
- loading checkboxes state?
- loading folding state?
- avoid empty state on filter change?

Handle disabled checkboxes when cascading
- don't select items with checkbox.disabled
- respect checked and disabled items (don't uncheck them)

Docs page

GQL Cursor support





*** Batch API ***

Cases:
1. Load whole tree in a single request
2. Load recursive sub-tree for particular node
3. Load all parents recursively for flatten-search and "indeterminate checkbox if children checked" scenarios
4. Load all children in particular layer with a query like:
    {
        filter: { parentId: { in: [1,2,3] }} // ids of unfolded children
        sorting: { [ { field: 'parentName' }, { field: 'name' }]} // to have children appear in order of parents
        range: { count: X } // where X is a sum of all childCounts
    }

Implementation option #1 - allow api to return children (complete internal Tree.loadMissing override)
We need to pass all necessary info (like isFolded(item)) to the callback
Api should return something like:
{ [parentId]: LazyDataSourceApiResponse } }

1 - yes
2 - yes
3 - yes
4 - yes

Cons: too complex to implement on client;

Implementation option #2 - allow api to return additional items:

- add  { prefetch: TItem[] } } to existing LazyDataSourceApiResponse
Loaded items are added to byId list.
However, they doesn't affect the tree (as we don't know whether or not all items or particular parent are pre-fetched)

1 - no
2 - no
3 - yes
4 - no

Implementation option #3 - a mix of 1 and 2:
LazyDataSourceApiResponse:
{
    prefetchChildren: { [parentId]: LazyDataSourceApiResponse }
    prefetchParents: TItem[]
}

1 - yes
2 - yes
3 - yes
4 - yes (prefetch items for unfolded groups when fetching a group, split them into responses by groupId)



## Other Ideas

Reset selection on changing filter
- investigate problems on demo
- we don't change the filter, user code does it. Should be implemented at user-side?

Smart Selection Cascading
- use hash instead of array for selection. Distinguish empty/undefined, true, and false values. Empty - means 'inherit from parent'
- this would allow to cascade selection without need to load all children
- how to change API w/o huge breaking change?

Editable rows
- how to inject edited version of row?
- how to get a table re-rendered if row is changed?

DB data sources
- are we need them?
  - APIs for editable table
  - helpers to wrap API to rebase DB and pass list to DS?

Item By ID store
- adjust to current use (remove lists caching)
- allow to put an external implementation?

Make lazy tree sync/async
- in some cases, we can complete tree load operation synchronously.
  But JS Promise-based algorithm would execute continuation on the next tick in any case
- we can build a Promise-like Monad to allow sync execution
- this would allow us to re-use LazyListView for ArrayDataSource

Cosmetic rename: LazyListView => LazyTreeView

Better LazyDataSourceApi - how to make implementation simpler?
- path to the item?
- depth?
- maybe an convention to reuse parentId somehow?
  - groping + parentId?
- instead of one API, introduce a more complex structure (like 'layers') to setup API for each entity individually?

Iterate loading algorithm to remove showing intermediate states when childCount is estimated less than actual
- while (notAllLoaded) { loadAgain() }
- to remove flicker when getChildCounts lied (provided wrong estimates)


Rework ArrayDataSource to re-use LazyListView.



