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
Copy file name to clipboardExpand all lines: README.md
+38-5Lines changed: 38 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,7 @@
4
4
5
5
6
6
7
+
7
8
# 1. vue-bootstrap4-table
8
9
9
10
> Advanced table based on Vue 2 and Bootstrap 4
@@ -184,6 +185,7 @@ columns: [{
184
185
placeholder:"Enter id"
185
186
},
186
187
sort:true,
188
+
uniqueId:true
187
189
},
188
190
{
189
191
label:"First Name",
@@ -221,6 +223,8 @@ columns: [{
221
223
|--|--|--|--|
222
224
|label | Name for the column header | String| " " |
223
225
|name | Name of the attribute that you would like to show from **`"rows"`** object. You can access nested objects properties with "." | String| " " |
226
+
|slot_name | Overrides default slot name assignment. For more details refer "Rows" section | String| " " |
227
+
|uniqueId | You can teach table which column has unique values. It helps table to do faster operations and it is really useful in "server_mode". | Boolean| false |
224
228
|filter | Configuration for the column filter. If you don't want to have filtering for specific columns, then just don't mention it :-) | Object| Empty |
225
229
|filter.type | Type of filter you want to use for your column. | String| " " |
226
230
|filter.placeholder | Placeholder is **`hint`** text for filter text box |String |" " |
@@ -336,19 +340,28 @@ At some point, you might want to override or format the values in the row cells.
336
340
{{props.cell_value}}
337
341
</b>
338
342
</template>
343
+
<template slot="lastname" slot-scope="props">
344
+
<b>
345
+
{{props.cell_value}}
346
+
</b>
347
+
</template>
339
348
</vue-bootstrap4-table>
340
349
...
341
350
<script>
342
351
...
343
352
columns: [{
344
353
label: "First Name",
345
-
name: "name.first_name", // access nested objects properties with "."
346
-
sort: false,
354
+
name: "name.first_name" // access nested objects properties with "."
355
+
},
356
+
{
357
+
label: "Last Name",
358
+
name: "name.last_name", // access nested objects properties with "."
359
+
slot_name: "lastname" // optional, if you don't provide slot name
360
+
//then default slot name will be name_last_name
347
361
},
348
362
{
349
363
label: "Email",
350
-
name: "email",
351
-
sort: true,
364
+
name: "email"
352
365
}],
353
366
...
354
367
</script>
@@ -359,6 +372,8 @@ You might have some columns getting the values from nested objects from **`rows`
359
372
360
373
You can see the above example, slot name for **`name.first_name`** column is **`name_first_name`**.
361
374
375
+
If you don't like this default "slot name" assignment, then you can set names to row slots as shown in the above example.
376
+
362
377
### 6.2.3. props
363
378
From **`slot-scope="props"`** you can access the following attributes.
364
379
@@ -1099,6 +1114,24 @@ fetchData() {
1099
1114
});
1100
1115
}
1101
1116
```
1117
+
### 14.1.5. Note
1118
+
To get best performance, it is recommended to mention in column config that which column have unique values. You can refer the below example.
1119
+
```javascript
1120
+
columns: [
1121
+
...
1122
+
{
1123
+
label:"id",
1124
+
name:"id",
1125
+
filter: {
1126
+
type:"simple",
1127
+
placeholder:"Enter id"
1128
+
},
1129
+
sort:true,
1130
+
uniqueId:true// like this
1131
+
}
1132
+
...
1133
+
]
1134
+
```
1102
1135
# 15. Events
1103
1136
1104
1137
## 15.1. on-select-row
@@ -1153,7 +1186,7 @@ Triggers after clicking refresh button. This event doesn't carry any payload.
1153
1186
# install dependencies
1154
1187
npm install
1155
1188
1156
-
# serve with hot reload at localhost:8080
1189
+
# serve with hot reload at localhost:8080 (if it is not running in 8080, then check console for right port)
0 commit comments