Lazy loading of nodes in treegrid

jQuery tree grid nodes can be loaded lazily from remote data store.

beforeTreeExpand event is used to request children nodes of the expanded node, and children are appended to expanded node upon arrival from server.

In server side code, we add pq_close property with value 1 or null to every row in response data to distinguish parent and children nodes respectively.

pq_close
1Node is closed
0Node is open
null or undefinedNode doesn't have any children

Following is the structure of the table in the database. (Only important fields are shown)

employeeID reportsTo FirstName LastName
1 2 Nancy Davolio
2 Andrew Fuller
3 2 Janet Leverling
4 2 Margaret Peacock
5 2 Steven Buchanan
6 5 Michael Suyama
7 5 Robert King
8 2 Laura Callahan
9 5 Anne Dodsworth