I'm integrating a new component called view-components/grids to Laravel 5.4, trough composer i make installation of composer require view-components/grids composer require view-components/eloquent-data-processing
After that i guess i need to add providers and alias in the app.conf , since it's not mentioned in the docs, but which names should i add ?
i get Class 'App\Http\Controllers\DbTableDataProvider' not found
The documentation mentions that it's compatible with Laravel, has someone integrated this component grid into laravel, how can i make it work? thanks in advance.
class testController extends Controller
{
public function index(){
$provider = new DbTableDataProvider($pdoConnection, 'redtable'); <--problem
$input = new InputSource($_GET);
// create grid
$grid = new Grid(
$provider,
// all components are optional, you can specify only columns
[
new TableCaption('My Grid'),
new Column('id'),
new Column('nombre'),
new Column('created_at'),
new DetailsRow(new SymfonyVarDump()), // when clicking on data rows, details will be shown
new PaginationControl($input->option('page', 1), 5), // 1 - default page, 5 -- page size
new PageSizeSelectControl($input->option('page_size', 5), [2, 5, 10]), // allows to select page size
new ColumnSortingControl('id', $input->option('sort')),
new ColumnSortingControl('nombre', $input->option('sort')),
new FilterControl('nombre', FilterOperation::OPERATOR_LIKE, $input->option('nombre')),
new CsvExport($input->option('csv')), // yep, that's so simple, you have CSV export now
new PageTotalsRow([
'id' => PageTotalsRow::OPERATION_IGNORE,
// 'age' => PageTotalsRow::OPERATION_AVG
])
]
);
// now you can render it:
echo $grid->render();
// or even this way:
echo $grid;
return view('test.tabla', compact('grid')); <--- is this right?
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire