This package is a Laravel integration for the Grid.js. The packages makes it easy to create data-grid for your Laravel application, for example admin panel lists. It covers the basic server side functionalities for Grid.js like search, sorting and pagination.
You can install the package via composer:
Install the Vue.js integration:
Publish the vendor files by running
Register the DataGrid fronted Vue.js component by adding the following line to your
The base of this package is the
\WdevRs\LaravelDatagrid\DataGrid\DataGrid class. This class is used to define the
columns and the behavior of the datagrid. While you can use this class directly from the controller, I'll
suggest extending it and create separate classes for each datagrid.
query method you can define what should be the base query for the DataGrid. It accepts a Laravel Query Builder object.
column method is used to define the columns of the DataGrid, the argument are as follows:
id- the name of the field in the database
name- the label which should appear in the DataGrid column header
formatter- optional, callable allows you to format the display of the column. As you can see from the above example probably the most elegant way to do this is to include a blade view and render it.
width- optional, the with of the column
When the DataGrid definition is ready, you can add it to the controller:
render method is called without arguments it will use the default view
or you can pass your own view and include the DataGrid blade file there:
The MIT License (MIT)