Thanks to onAttached event, you can now put your custom variables to datagrid template and register macros to datagrid template without need to connect datagrid to component tree in constructor, which breaked pagination.
Adding your own macros and other variables looks like this:
$grid = new Datagrid();
$grid->onAttached[] = function(Datagrid $datagrid) {
$datagrid->template->addFilter('myCoolMacro', function ($s) {
return myCoolMacro($s);
});
$datagrid->template->myVariable = $this->myVariable;
};
Thanks to onAttached event, you can now put your custom variables to datagrid template and register macros to datagrid template without need to connect datagrid to component tree in constructor, which breaked pagination.
Adding your own macros and other variables looks like this: