Usage
To use the Layout class, you need to include it in the getLayout
method of your grid class. Here is an example:
use BoredProgrammers\LaraGrid\Components\Layout;
class MyGrid extends BaseLaraGrid
{
protected function getLayout(BaseLaraGridTheme $theme): array
{
return Layout::make()
->setHeaderRenderer(function () {
return view('my-grid.header');
})
->setFooterRenderer(function () {
return "This is the footer";
})
->setFooterRenderer(function () {
return "<b>This is the footer</b>";
})
}
}
In the example above, we have used the setHeaderRenderer
method to set the header of the grid. The setHeaderRenderer
method takes a closure as an argument. The closure can return a view, string, or any other valid HTML.
The setFooterRenderer
method works the same way as the setHeaderRenderer
method.
Last updated
Was this helpful?