Dynamic Loading mode allows loading data partially, not all at once, by a client-side request. It decreases the initial loading time and loading of the server.
To work correctly, the related mode should be enabled on the client side:
To activate the mode you should use the method dynamic_loading():
$grid->dynamic_loading([$rowsNum]);
In the 'dynamic loading' mode you can't use GROUP BY within SQL query
Parameters:
Normally, the connector makes all operations automatically and doesn't need any customization.
But in case of the dynamic loading into Tree/TreeGrid, a database can contain a field indicating if the current item is a branch or a leaf. In the beforeRender event handler you are allowed to mark an item as a leaf or a branch (it decreases the number of SQL queries and increases the performance).
function custom_define($item){
if ($item->get_value("is_a_branch"))
$item->set_kids(true);
else
$item->set_kids(false);
}
$tree->event->attach("beforeRender","custom_define");
The same approach can be used for the non-dynamic mode of Tree/TreeGrid as well. It's not obligatory but lets you increase the data generation performance.
Back to top