Get expanded item in Treegrid

How do we get the expanded node in treegrid, which can be used for a query to DB when it is expanded? Like lazy loading the data on expansion

Lazy loading happens in a different way: you implement a DataProvider (extend AbstractBackEndHierarchicalDataProvider) that can fetch items from a hierarchy, and the DataProvider has a method TreeGrid can invoke to check whether a specific node has a child nodes.