File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -55,3 +55,28 @@ Then create your view on `resources/views/users/datatables/name.blade.php`.
5555``` php
5656Hi {{ $name }}!
5757```
58+
59+
60+ <a name =" selected-column " ></a >
61+ ## Edit only the requested Columns
62+
63+ > {tip} You can skip editing the columns that are not in your requested payload by using ` editOnlySelectedColumns ` before using ` editColumn `
64+
65+ ``` php
66+ use DataTables;
67+
68+ Route::get('user-data', function() {
69+ $model = App\User::query();
70+
71+ return DataTables::eloquent($model)
72+ ->editColumn('id', function () {
73+ return view('users.datatables.id'); // View will always be rendered
74+ })
75+ ->editOnlySelectedColumns()
76+ ->editColumn('name', function () {
77+ return 'Hi ' . $user->name . '!'; // View will only be rendered if the column is in the payload
78+ only if in the payload
79+ })
80+ ->toJson();
81+ });
82+ ```
You can’t perform that action at this time.
0 commit comments