Dynamic Loading

Common

Dynamic Loading mode allows loading data partially, not all at once, by a client-side request. It decreases initial loading time and loading of server.

To work correctly, th erelated mode should be enabled on the client side:

  • grid - smart rendering and paging modes
  • treegrid - dynamic branch loading mode
  • tree - dynamic branch loading mode
  • combo - partial autocomplete (you don't need it for normal autocomplete)
  • dataview - dynamiс scrolling or dynamic paging

There are 2 properties that enable dynamic loading:

  • EnableDynamicLoading - for tree/treeGrid

    enables or disables dynamic loading of child items (rows, nodes)

  • SetDynamicLoading(int) - for grid/combo

    sets a number of items loaded per single requests

//EnableDynamicLoading
 dhtmlxTreeConnector connector = new dhtmlxTreeConnector(/*.....*/);
 connector.EnableDynamicLoading = true;_enable dynamic branches loading 
//SetDynamicLoading
 dhtmlxGridConnector connector = new dhtmlxGridConnector(/*.....*/);
 connector.SetDynamicLoading(30);//enable partial grid loading (30 records per request)

In the 'dynamic loading' mode you can't use GROUP BY within SQL query

Tree/TreeGrid specific

Check for child nodes/rows existence is also built into the connector. If for some reasons you need to customize this check, you can attach an event handler to the RequestHasChildren event for Tree or TreeGrid connectors. The handler will receive reference to the node/row being checked and you can assign to the HasChildren property the value depending on your own logic.

dhtmlxTreeGridConnector connector = new dhtmlxTreeGridConnector(/*...*/);
connector.RequestHasChildren += new EventHandler
<RequestChildrenEventArgs<dhtmlxTreeGridDataItem>>(connector_RequestHasChildren);
 
void connector_RequestHasChildren(
    object sender,
    RequestChildrenEventArgs<dhtmlxTreeGridDataItem> e
)
{
   if (TodayIsMonday)
      e.HasChildren = false;//no children on mondays
   else
      e.HasChildren = true;
}
Back to top