File tree Expand file tree Collapse file tree 1 file changed +33
-1
lines changed Expand file tree Collapse file tree 1 file changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -46,16 +46,48 @@ Route::get('user-data', function() {
4646 $model = App\User::query();
4747
4848 return DataTables::eloquent($model)
49- ->editColumn('name', 'users.datatables.into ')
49+ ->editColumn('name', 'users.datatables.name ')
5050 ->toJson();
51+
5152});
5253```
5354
5455Then create your view on ` resources/views/users/datatables/name.blade.php ` .
56+
5557``` php
5658Hi {{ $name }}!
5759```
5860
61+ <a name =" view-with-data " ></a >
62+ ## Edit Column with View and Data
63+
64+ > {tip} You can use view to render your added column by passing the view path as the second argument on ` editColumn ` api.
65+
66+ ``` php
67+ use DataTables;
68+
69+ Route::get('user-data', function() {
70+ $model = App\User::query();
71+
72+ $externalData = 'External';
73+
74+ return DataTables::eloquent($model)
75+ ->editColumn('name', ['users.datatables.name', [
76+ 'externalData' => $externalData,
77+ ]])
78+ ->toJson();
79+
80+ });
81+ ```
82+
83+ Then create your view on ` resources/views/users/datatables/name.blade.php ` .
84+
85+ ``` php
86+ Hi {{ $name }}!
87+
88+ Here is some external data: {{ $externalData }}.
89+ ```
90+
5991
6092<a name =" selected-column " ></a >
6193## Edit only the requested Columns
You can’t perform that action at this time.
0 commit comments