@sulzanoks/vue-datatable 0.3.5 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,29 +1,39 @@
1
- # DatatableCard Component
1
+ # Vue DatatableCard
2
2
 
3
- DatatableCard is a custom Vue.js component designed to provide a flexible and customizable datatable for your web applications. It is built from scratch, inspired by the Bootstrap datatable, but with added features to support Vue.js style links and row selection.
3
+ `DatatableCard` is a server-side Vue 3 datatable component designed for Laravel applications using a DataTables-compatible backend, such as [`yajra/laravel-datatables-oracle`](https://yajrabox.com/docs/laravel-datatables).
4
4
 
5
- ## Installation
5
+ It supports server-side pagination, sorting, global and per-column search, row selection, clickable rows, custom row actions, localized interface text, Inertia or native links, custom cell rendering, and conditional cell classes.
6
+
7
+ ## Requirements
8
+
9
+ - Vue 3
10
+ - Axios
11
+ - `@inertiajs/vue3`
12
+ - A server endpoint that accepts DataTables-style query parameters and returns a compatible response
6
13
 
7
- You can install the DatatableCard component using npm:
14
+ The component also uses Bootstrap/Material-style classes and Material Icons in its default markup.
15
+
16
+ ## Installation
8
17
 
9
18
  ```bash
10
19
  npm install @sulzanoks/vue-datatable
11
20
  ```
12
21
 
13
- ## Usage
14
-
15
- To use the DatatableCard component in your Vue.js application, you can import it and include it in your component's template. Here's an example of how to use it:
22
+ ## Basic usage
16
23
 
17
24
  ```vue
18
25
  <template>
19
- <div>
20
- <datatable-card
21
- :card-title="cardTitle"
22
- :columns="columns"
23
- :url="dataUrl"
24
- >
25
- </datatable-card>
26
- </div>
26
+ <DatatableCard
27
+ ref="datatable"
28
+ card-title="Users"
29
+ card-icon="people"
30
+ url="/users/datatable"
31
+ :columns="columns"
32
+ :order="[{ column: 0, dir: 'asc' }]"
33
+ :page-length="25"
34
+ clickable-rows
35
+ @row-click="openUser"
36
+ />
27
37
  </template>
28
38
 
29
39
  <script>
@@ -31,169 +41,506 @@ import DatatableCard from '@sulzanoks/vue-datatable';
31
41
  import '@sulzanoks/vue-datatable/dist/style.css';
32
42
 
33
43
  export default {
34
- components: {
35
- DatatableCard,
36
- },
37
- data() {
38
- return {
39
- cardTitle: 'My Datatable',
40
- columns: [
41
- // Define your datatable columns here
42
- // Example: { data: 'id', name: 'ID', sortable: true, searchable: true }
43
- ],
44
- dataUrl: '/api/data', // Replace with your data endpoint URL
45
- };
46
- },
44
+ components: {
45
+ DatatableCard,
46
+ },
47
+
48
+ data() {
49
+ return {
50
+ columns: [
51
+ {
52
+ data: 'id',
53
+ name: 'users.id',
54
+ displayName: 'ID',
55
+ searchable: false,
56
+ width: '80px',
57
+ },
58
+ {
59
+ data: 'name',
60
+ name: 'users.name',
61
+ displayName: 'Name',
62
+ link: row => `/users/${row.id}`,
63
+ },
64
+ {
65
+ data: 'email',
66
+ name: 'users.email',
67
+ displayName: 'Email',
68
+ },
69
+ ],
70
+ };
71
+ },
72
+
73
+ methods: {
74
+ openUser(row) {
75
+ window.location.href = `/users/${row.id}`;
76
+ },
77
+ },
47
78
  };
48
79
  </script>
49
80
  ```
50
81
 
51
82
  ## Props
52
83
 
53
- The DatatableCard component accepts the following props:
54
-
55
- - `cardTitle` (String): The title for the datatable card.
56
- - `clickable-rows` (Boolean, optional, default: false): Set to true to enable `row-click` event.
57
- - `columns` (Array): An array of column objects defining the datatable columns.
58
- - `data` (String): The key to access the data for this column in the API response.
59
- - `displayName` (String): The display name or label for this column.
60
- - `name` (String): The unique name or identifier for this column.
61
- - `searchable` (Boolean, optional, default: true): Set to `false` to disable searching for this column.
62
- - `sortable` (Boolean, optional, default: true): Set to `false` to disable sorting for this column.
63
- - `visible` (Boolean, optional, default: true): Set to `false` to remove column from table.
64
- - `width` (String, optional): Set solumn to width specified css param.
65
- - `linkParams` (Object, optional): Defines link parameters for generating Vue.js style links.
66
- - `name` (String): The name of the Vue.js route to navigate to when clicking the link.
67
- - `resourceIds` (Array): An array of resource IDs to use in generating the link. Replace with actual resource IDs.
68
- - `query` (Object, optional): object of attributes to include in link query params
69
- - `url` (String): The URL for fetching datatable data.
70
- - `selectableRows` (Boolean): Set to `true` to enable row selection. For now only works if you have a, `id` column in your data set.
71
- - `order` (Array): The initial column sorting order. example: `[{ column: 0, dir: 'asc' }]`
72
- - `advancedSearch` (Boolean): Set to `true` to enable advanced search, which generates an individual search input for each searchable column.
73
- - `loadDataOnInit` (Boolean): Set to `true` to load data when the component is initialized.
74
- - `cardIconStyle` (String, optional, default: 'card-header-primary'. There are no other options): The CSS class to apply to the card's header for icon styling.
75
- - `cardIcon` (String, optional, default: null): The name of an icon from [Google Icons](https://fonts.google.com/icons) to display in the card's header. Provide the icon name without any additional markup, such as `<i>` tags. For example, if you want to use the "account_circle" icon, set this prop to `'account_circle'`. If not specified, no icon will be displayed in the card's header.
76
- - `cardClasses` (String, optional, default: null): Additional CSS classes to apply to the card.
77
- - `createLink` (String, optional, default: null): A link or URL to navigate to when clicking a "Create" button or link within the card.
78
- - `requestQueryParams` (Object, optional): additional request query parameters to include when loading data from server.
79
- - `actions` (Array, optional): Array of action objects defining action buttons for each row.
80
- - `emit` (String, required): name of event to emit upon click
81
- - `icon` (String, optional): The name of an icon from [Google Icons](https://fonts.google.com/icons) to display inside button.
82
- - `label` (String, optional): Text to display inside button.
83
- - `class` (String, optional): CSS class to apply to button.
84
-
85
- ## Link Parameters (`linkParams`)
86
-
87
- The `generateLink` method now supports **two modes** for building links:
88
-
89
- ### 1. Laravel Route Name (default / original behavior)
90
-
91
- Use when you want to leverage Laravel named routes via Ziggy’s `route()` helper.
84
+ | Prop | Type | Default | Description |
85
+ |---|---|---:|---|
86
+ | `url` | `String` | required | Server endpoint used to load table data. |
87
+ | `columns` | `Array` | required | Column definitions. See [Column configuration](#column-configuration). |
88
+ | `locale` | `String` | `'en'` | Locale used for built-in interface text. |
89
+ | `vocabulary` | `Object` | `{}` | Custom translations grouped by locale. |
90
+ | `cardTitle` | `String` | `null` | Card title. |
91
+ | `cardIcon` | `String` | `null` | Material Icon name displayed in the header. |
92
+ | `cardIconStyle` | `String` | `'card-header-primary'` | CSS class applied to the icon header when there is no error. |
93
+ | `cardClasses` | `String` | `null` | Additional classes applied to the root card. |
94
+ | `createLink` | `String` | `null` | URL used by the header create button. It is rendered as an Inertia `<Link>`. |
95
+ | `selectableRows` | `Boolean` | `false` | Enables row checkboxes. Rows must contain an `id` value. |
96
+ | `order` | `Array` | `[{ column: 0, dir: 'asc' }]` | Initial DataTables sorting configuration. |
97
+ | `advancedSearch` | `Boolean` | `false` | Enables one search field for every searchable column. |
98
+ | `loadDataOnInit` | `Boolean` | `true` | Loads data when the component mounts. |
99
+ | `requestQueryParams` | `Object` | `{}` | Extra query parameters included with every server request. |
100
+ | `actions` | `Array` | `undefined` | Row action button definitions. |
101
+ | `clickableRows` | `Boolean` | `false` | Emits `row-click` when a table row is clicked. |
102
+ | `hyperlinkStyle` | `String` | `'Link'` | Controls column link rendering. Supported values are `'Link'` and `'a'`. |
103
+ | `pageLength` | `Number` | `10` | Initial number of rows per page. |
104
+
105
+ In templates, camelCase props can be passed using kebab-case, for example `page-length`, `clickable-rows`, and `request-query-params`.
106
+
107
+ ## Column configuration
108
+
109
+ Each entry in `columns` supports the following properties:
110
+
111
+ | Property | Type | Default | Description |
112
+ |---|---|---:|---|
113
+ | `data` | `String` | required | Row property displayed in the cell and sent as the DataTables column `data` value. |
114
+ | `name` | `String` | recommended | Server-side column name. Required for advanced search and normally used by the backend for filtering and sorting. |
115
+ | `displayName` | `String` | required | Column heading and advanced-search placeholder. |
116
+ | `searchable` | `Boolean` | `true` | Set to `false` to disable searching for the column. |
117
+ | `sortable` | `Boolean` | `true` | Set to `false` to disable sorting for the column. |
118
+ | `visible` | `Boolean` | `true` | Set to `false` to hide the column while keeping it in the request configuration. |
119
+ | `width` | `String` | — | CSS width applied to the heading, such as `'120px'` or `'20%'`. |
120
+ | `link` | `Function` | — | Receives the current row and returns the destination URL. |
121
+ | `render` | `Function` | — | Receives the current row and returns HTML rendered with `v-html`. |
122
+ | `classes` | `String \| Array` | — | Static classes or conditional numeric class rules for the table cell. |
123
+
124
+ ### Column links
125
+
126
+ Define `link` as a function that receives the current row:
92
127
 
93
128
  ```js
94
129
  {
95
- data: 'title',
96
- linkParams: {
97
- name: 'users.show', // Laravel route name
98
- resourceIds: ['id'], // values taken from the row
99
- query: { tab: 'info' } // optional query params
100
- }
130
+ data: 'name',
131
+ name: 'users.name',
132
+ displayName: 'Name',
133
+ link: row => `/users/${row.id}`,
101
134
  }
102
135
  ```
103
136
 
104
- ➡️ If `row.id = 5`, this builds:
137
+ By default, links use Inertia's `<Link>` component:
138
+
139
+ ```vue
140
+ <DatatableCard hyperlink-style="Link" />
141
+ ```
142
+
143
+ Use a native anchor instead when a full browser navigation or download is required:
144
+
145
+ ```vue
146
+ <DatatableCard hyperlink-style="a" />
105
147
  ```
106
- /users/5?tab=info
148
+
149
+ The previous `linkParams` and Ziggy-based `generateLink()` API is no longer supported. Generate the URL in the `link(row)` callback or return a ready-to-use URL from the backend:
150
+
151
+ ```js
152
+ {
153
+ data: 'invoice_number',
154
+ name: 'invoices.invoice_number',
155
+ displayName: 'Invoice',
156
+ link: row => row.url,
157
+ }
107
158
  ```
108
159
 
109
- ### 2. Link Template
160
+ ### Custom cell rendering
110
161
 
111
- Use when you want full control over the URL structure without relying on Laravel route names.
162
+ Use `render(row)` to return custom HTML:
112
163
 
113
- #### Object Form
114
164
  ```js
115
165
  {
116
- data: 'title',
117
- linkParams: {
118
- template: '/users/{id}/posts/{post_id}',
119
- params: { post_id: 'latest' }, // override or add interpolation values
120
- query: { filter: 'active' } // optional query params
121
- }
166
+ data: 'status',
167
+ name: 'status',
168
+ displayName: 'Status',
169
+ render: row => `<span class="badge bg-success">${row.status}</span>`,
122
170
  }
123
171
  ```
124
- ➡️ If `row.id = 5`, this builds:
172
+
173
+ `render()` output is inserted using `v-html`. Only return trusted or sanitized HTML. When `render` is defined, it takes precedence over `link` and the normal text value.
174
+
175
+ ### Static cell classes
176
+
177
+ ```js
178
+ {
179
+ data: 'total',
180
+ name: 'total',
181
+ displayName: 'Total',
182
+ classes: 'text-end fw-bold',
183
+ }
125
184
  ```
126
- /users/5/posts/latest?filter=active
185
+
186
+ ### Conditional cell classes
187
+
188
+ `classes` can also be an array of numeric rules. The `min` and `max` limits are inclusive.
189
+
190
+ ```js
191
+ {
192
+ data: 'difference',
193
+ name: 'difference',
194
+ displayName: 'Difference',
195
+ classes: [
196
+ { max: -0.01, class: 'text-danger' },
197
+ { min: 0, max: 0, class: 'text-muted' },
198
+ { min: 0.01, class: 'text-success' },
199
+ ],
200
+ }
127
201
  ```
128
202
 
129
- #### String Shorthand
203
+ Use `valueKey` to evaluate another row property:
204
+
130
205
  ```js
131
206
  {
132
- data: 'title',
133
- linkParams: '/users/{id}'
207
+ data: 'hourly_rate',
208
+ name: 'hourly_rate',
209
+ displayName: 'Hourly rate',
210
+ classes: [
211
+ {
212
+ valueKey: 'rate_difference',
213
+ max: -0.01,
214
+ class: 'bg-danger-subtle',
215
+ },
216
+ ],
134
217
  }
135
218
  ```
136
- ➡️ If `row.id = 5`, this builds:
219
+
220
+ String values are parsed as numbers, and a trailing percent sign is ignored during parsing.
221
+
222
+ ## Localization
223
+
224
+ The component translates its interface using the `locale` and `vocabulary` props.
225
+
226
+ ```vue
227
+ <DatatableCard
228
+ locale="lv"
229
+ :vocabulary="vocabulary"
230
+ :columns="columns"
231
+ url="/users/datatable"
232
+ />
137
233
  ```
138
- /users/5
234
+
235
+ ```js
236
+ export default {
237
+ data() {
238
+ return {
239
+ vocabulary: {
240
+ lv: {
241
+ search: 'Meklēt',
242
+ close: 'Aizvērt',
243
+ createNew: 'Izveidot',
244
+ showEntries: 'Rādīt ierakstu skaitu',
245
+ actions: 'Darbības',
246
+ showingRecords: 'Rāda {first}. līdz {last}. no {filtered} ierakstiem',
247
+ totalRecords: 'kopā {total} ieraksti',
248
+ first: 'Pirmā',
249
+ previous: 'Iepriekšējā',
250
+ next: 'Nākamā',
251
+ last: 'Pēdējā',
252
+ loadingError: 'Neizdevās ielādēt datus',
253
+ },
254
+ },
255
+ };
256
+ },
257
+ };
139
258
  ```
140
259
 
141
- ### Template Placeholders
260
+ ### Translation keys
142
261
 
143
- Templates support both styles:
144
- - `{key}` → `/users/{id}`
145
- - `:key` → `/users/:id`
262
+ | Key | Used for |
263
+ |---|---|
264
+ | `search` | Search placeholder, search button, and tooltip |
265
+ | `close` | Close-search tooltip |
266
+ | `createNew` | Create-link tooltip |
267
+ | `showEntries` | Page-length menu tooltip |
268
+ | `actions` | Row actions column heading |
269
+ | `showingRecords` | Record-range text; supports `{first}`, `{last}`, and `{filtered}` |
270
+ | `totalRecords` | Unfiltered total; supports `{total}` |
271
+ | `first` | First-page button |
272
+ | `previous` | Previous-page button |
273
+ | `next` | Next-page button |
274
+ | `last` | Last-page button |
275
+ | `loadingError` | Generic data-loading error |
146
276
 
147
- Both will be replaced with the row’s value (or overridden via `params`).
277
+ Translation lookup order is:
148
278
 
149
- ### Notes
150
- - If both `params` and row values define the same key, `params` takes precedence.
151
- - Query parameters (`query`) are supported in both modes.
152
- - If you just need a simple route name, use **mode 1**; if you want custom URLs, use **mode 2**.
279
+ 1. `vocabulary[locale][key]`
280
+ 2. `vocabulary.en[key]`
281
+ 3. package defaults for the selected locale
282
+ 4. package English default
283
+ 5. the translation key itself
153
284
 
154
- ## Internal Methods
285
+ The locale key must match the `locale` prop exactly.
155
286
 
156
- These methods are meant to be used by component internally, but maybe you can find use for them
287
+ ## Advanced search
157
288
 
158
- - `toggleSearch()`: Toggle the search input.
159
- - `clearSearch()`: Clear the search bar and reload data.
160
- - `setAdvancedSearchFilters()`: Set advanced search filters based in input element values and reload data.
161
- - `loadData()`: Load datatable data.
162
- - `initColumnSettings()`: Initialize column settings.
163
- - `setPageLength(length)`: Set the number of rows per page and reload data.
164
- - `setPage(page)`: Set the current page and reload data.
165
- - `setSearchTerm()`: Set the full text search term for basic search on all columns and reload data.
166
- - `setSorting(index)`: Set the sorting order for a column and reload data.
167
- - `generateLink(linkParams, row)`: Generate a link based on parameters and row data.
168
- - `selectAllRows()`: Select or deselect all rows.
169
- - `clearSelectedRows()`: Clear the selected rows.
289
+ Enable per-column inputs with:
170
290
 
171
- ## Methods
172
- - `getSelectedRows()`: Returns array of selected rows
173
- - `filterColumns(params)`: Filter columns based on parameters and reload data.
174
- ```javascript
175
- this.$refs.myDataTable.filterColumns([
176
- {
177
- name: 'serial_number',
178
- value: this.uniqueId,
291
+ ```vue
292
+ <DatatableCard advanced-search />
293
+ ```
294
+
295
+ An input is generated for each column where `searchable !== false`. Each searchable column should have a unique `name` value.
296
+
297
+ The search toolbar is opened and closed with the header search icon. Submitting the form resets pagination to the first page and reloads the data.
298
+
299
+ ## Global search
300
+
301
+ When `advancedSearch` is disabled, the component displays a global search field. Input is debounced by 500 milliseconds before a new request is sent.
302
+
303
+ ## Row selection
304
+
305
+ ```vue
306
+ <DatatableCard
307
+ ref="datatable"
308
+ selectable-rows
309
+ :columns="columns"
310
+ url="/users/datatable"
311
+ />
312
+ ```
313
+
314
+ Rows must include an `id` property. Selection applies to the currently loaded page and is cleared whenever data is reloaded.
315
+
316
+ Read the selected IDs through the public method:
317
+
318
+ ```js
319
+ const selectedIds = this.$refs.datatable.getSelectedRows();
320
+ ```
321
+
322
+ ## Clickable rows
323
+
324
+ ```vue
325
+ <DatatableCard
326
+ clickable-rows
327
+ @row-click="handleRowClick"
328
+ />
329
+ ```
330
+
331
+ ```js
332
+ methods: {
333
+ handleRowClick(row) {
334
+ console.log(row);
335
+ },
336
+ }
337
+ ```
338
+
339
+ Clicks on selection checkboxes, column links, and action buttons do not trigger `row-click`.
340
+
341
+ ## Row actions
342
+
343
+ Define one or more buttons using the `actions` prop:
344
+
345
+ ```vue
346
+ <DatatableCard
347
+ :columns="columns"
348
+ :actions="actions"
349
+ url="/users/datatable"
350
+ @edit="editUser"
351
+ @remove="removeUser"
352
+ />
353
+ ```
354
+
355
+ ```js
356
+ export default {
357
+ data() {
358
+ return {
359
+ actions: [
360
+ {
361
+ emit: 'edit',
362
+ icon: 'edit',
363
+ label: 'Edit',
364
+ class: 'btn-primary',
365
+ },
366
+ {
367
+ emit: 'remove',
368
+ icon: 'delete',
369
+ label: 'Delete',
370
+ class: 'btn-danger',
371
+ },
372
+ ],
373
+ };
374
+ },
375
+
376
+ methods: {
377
+ editUser(row) {
378
+ // Handle edit action
179
379
  },
180
- {
181
- name: 'product_name',
182
- value: this.productName,
183
- }
184
- ]);
380
+
381
+ removeUser(row) {
382
+ // Handle remove action
383
+ },
384
+ },
385
+ };
386
+ ```
387
+
388
+ Each action supports:
389
+
390
+ | Property | Type | Description |
391
+ |---|---|---|
392
+ | `emit` | `String` | Event name emitted with the current row as its payload. |
393
+ | `icon` | `String` | Optional Material Icon name. |
394
+ | `label` | `String` | Optional button label. |
395
+ | `class` | `String \| Object \| Array` | Classes passed to the button's Vue `:class` binding. |
396
+
397
+ The actions column is only rendered when the array contains at least one item.
398
+
399
+ ## Extra request parameters
400
+
401
+ Use `requestQueryParams` to append application-specific filters:
402
+
403
+ ```vue
404
+ <DatatableCard
405
+ :request-query-params="{
406
+ organization_id: organizationId,
407
+ active: 1,
408
+ }"
409
+ />
410
+ ```
411
+
412
+ These values are merged into the same Axios request as the DataTables parameters.
413
+
414
+ ## Slots
415
+
416
+ ### `header`
417
+
418
+ Adds custom content at the beginning of the card header. The built-in icon, title, error text, and controls are still rendered.
419
+
420
+ ```vue
421
+ <DatatableCard>
422
+ <template #header>
423
+ <span class="text-muted">Updated moments ago</span>
424
+ </template>
425
+ </DatatableCard>
426
+ ```
427
+
428
+ ### `actions`
429
+
430
+ Adds custom controls before the built-in create, search, and page-length controls.
431
+
432
+ ```vue
433
+ <DatatableCard>
434
+ <template #actions>
435
+ <li>
436
+ <button type="button" @click="exportRows">Export</button>
437
+ </li>
438
+ </template>
439
+ </DatatableCard>
440
+ ```
441
+
442
+ ### Default slot
443
+
444
+ Adds content inside the card body above the search toolbar and table.
445
+
446
+ ```vue
447
+ <DatatableCard>
448
+ <div class="alert alert-info">
449
+ Select a row to view details.
450
+ </div>
451
+ </DatatableCard>
452
+ ```
453
+
454
+ ## Public methods
455
+
456
+ Assign a template ref before calling public methods:
457
+
458
+ ```vue
459
+ <DatatableCard ref="datatable" />
460
+ ```
461
+
462
+ ### `refresh()`
463
+
464
+ Resets sorting, filters, pagination, selection, and search inputs. When `loadDataOnInit` is `true`, it reloads data; otherwise it clears the rows.
465
+
466
+ ```js
467
+ this.$refs.datatable.refresh();
468
+ ```
469
+
470
+ ### `filterColumns(params)`
471
+
472
+ Sets server-side search values for named columns, resets pagination, and reloads data.
473
+
474
+ ```js
475
+ this.$refs.datatable.filterColumns([
476
+ {
477
+ name: 'serial_number',
478
+ value: this.uniqueId,
479
+ },
480
+ {
481
+ name: 'product_name',
482
+ value: this.productName,
483
+ },
484
+ ]);
485
+ ```
486
+
487
+ Columns not included in `params` have their current search value cleared.
488
+
489
+ ### `getSelectedRows()`
490
+
491
+ Returns the selected row IDs from the currently loaded page:
492
+
493
+ ```js
494
+ const selectedIds = this.$refs.datatable.getSelectedRows();
185
495
  ```
186
- - `refresh()`: Clears all sorting and filters, reloads or clears data based on `loadDataOnInit` prop.
187
496
 
188
497
  ## Events
189
- - `row-click`: Emitted when row is click if `clickable-rows` prop is set to true. The event payload contains the clicked row data.
498
+
499
+ | Event | Payload | Description |
500
+ |---|---|---|
501
+ | `row-click` | Current row object | Emitted when `clickableRows` is enabled and the user clicks a row. |
502
+ | Action-defined event | Current row object | Emitted when a configured row action is clicked. The event name comes from `action.emit`. |
503
+
504
+ ## Server-side API
505
+
506
+ The component sends DataTables-style parameters through an Axios `GET` request, including:
507
+
508
+ - `draw`
509
+ - `columns`
510
+ - `order`
511
+ - `start`
512
+ - `length`
513
+ - `search`
514
+ - values from `requestQueryParams`
515
+
516
+ The endpoint should return at least:
517
+
518
+ ```json
519
+ {
520
+ "data": [],
521
+ "recordsTotal": 0,
522
+ "recordsFiltered": 0
523
+ }
524
+ ```
525
+
526
+ The component also recognizes an `error` field in a successful response:
527
+
528
+ ```json
529
+ {
530
+ "error": "Unable to load records"
531
+ }
532
+ ```
533
+
534
+ When an Axios request fails, the component displays the response message when available, otherwise it uses the localized `loadingError` text.
190
535
 
191
536
  ## Compatibility
192
537
 
193
- This component is designed to work with Laravel's [`yajra/laravel-datatables-oracle`](https://yajrabox.com/docs/laravel-datatables). It may work with other packages that use a similar input/output structure, but it has not been tested extensively with other packages.
538
+ The component is designed for Laravel endpoints powered by [`yajra/laravel-datatables-oracle`](https://yajrabox.com/docs/laravel-datatables), but it can work with any backend that accepts and returns the same request/response structure.
539
+
540
+ ## Security
194
541
 
195
- Please make sure that your Laravel backend and the API endpoints are configured to work with this component.
542
+ The `render(row)` column callback uses Vue's `v-html`. Never insert unsanitized user-controlled content through `render()`.
196
543
 
197
544
  ## License
198
545
 
199
- This DatatableCard component is open-source software licensed under the MIT License. See the [LICENSE](LICENSE) file for more information.
546
+ This project is open-source software licensed under the MIT License. See [LICENSE](LICENSE) for details.