
In a very large List Tree Model or Column Tree Model, it may make sense not to load all of the items when you create the tree. Instead, you can load items "on demand", that is, when the user actually displays the node to which the items belong.
You must already have instantiated the List Tree Model or Column Tree Model.
You must have a class in your application that implements one of the following interfaces:
If you are using the List Tree Model, interface IF_LIST_TREE_MODEL_ITEM_PROV.
If you are using the Column Tree Model, interface IF_COLUMN_TREE_MODEL_ITEM_PROV.
When you add new nodes to the tree model, set the flag ITEMSINCOM to 'X'. This informs the tree model that you want to load the items for that node on demand.
In your application class, implement the method LOAD_ITEMS of the relevant interface (see the Prerequisites section above) so that it fills the internal table item_table with the attributes of the items you want to load.
Depending on which version of the tree model you are using, call one of the following interfaces and pass to it the instance of your application class that will provide the item information:
|
Tree Model version you are using |
Method you should call |
|---|---|
|
List Tree Model |
set_item_provider of CL_LIST_TREE_MODEL |
|
Column Tree Model |
set_item_provider of CL_COLUMN_TREE_MODEL |
When the user displays a node for which the items have not yet been loaded, and for which you set the ITEMSINCOM attribute to 'X', it calls the LOAD_ITEMS method of the object you specified in the SET_ITEM_PROVIDER method. This loads the items into the tree model instance, after which, the system resets the ITEMSINCOM attribute to its initial value.