You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using `addIndexColumn` will add another column on your response with a column name that is set on [`index_column`](/docs/{{package}}/{{version}}/general-settings#index-column) configuration.
19
-
The default index column name is `DT_RowIndex`
19
+
The default index column name is `DT_RowIndex`.
20
+
21
+
If you want to customize the index used by the `DT_RowIndex`, you can use `setRowId('COLUMN')` to change the index number.
22
+
23
+
```php
24
+
use DataTables;
25
+
26
+
Route::get('user-data', function() {
27
+
$model = App\User::query();
28
+
29
+
return DataTables::eloquent($model)
30
+
->setRowId('id')
31
+
->toJson();
32
+
});
33
+
```
34
+
35
+
Be careful with this option, an index should be unique and an integer to be useful for DataTables.
0 commit comments