Skip to content

Commit 8cf3174

Browse files
authored
updated readme for next release
1 parent 05e8fe3 commit 8cf3174

File tree

1 file changed

+38
-5
lines changed

1 file changed

+38
-5
lines changed

README.md

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55

66

7+
78
# 1. vue-bootstrap4-table
89

910
> Advanced table based on Vue 2 and Bootstrap 4
@@ -184,6 +185,7 @@ columns: [{
184185
placeholder: "Enter id"
185186
},
186187
sort: true,
188+
uniqueId: true
187189
},
188190
{
189191
label: "First Name",
@@ -221,6 +223,8 @@ columns: [{
221223
|--|--|--|--|
222224
|label | Name for the column header | String| " " |
223225
|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 |
224228
|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 |
225229
|filter.type | Type of filter you want to use for your column. | String| " " |
226230
|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.
336340
{{props.cell_value}}
337341
</b>
338342
</template>
343+
<template slot="lastname" slot-scope="props">
344+
<b>
345+
{{props.cell_value}}
346+
</b>
347+
</template>
339348
</vue-bootstrap4-table>
340349
...
341350
<script>
342351
...
343352
columns: [{
344353
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
347361
},
348362
{
349363
label: "Email",
350-
name: "email",
351-
sort: true,
364+
name: "email"
352365
}],
353366
...
354367
</script>
@@ -359,6 +372,8 @@ You might have some columns getting the values from nested objects from **`rows`
359372

360373
You can see the above example, slot name for **`name.first_name`** column is **`name_first_name`**.
361374

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+
362377
### 6.2.3. props
363378
From **`slot-scope="props"`** you can access the following attributes.
364379

@@ -1099,6 +1114,24 @@ fetchData() {
10991114
});
11001115
}
11011116
```
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+
```
11021135
# 15. Events
11031136

11041137
## 15.1. on-select-row
@@ -1153,7 +1186,7 @@ Triggers after clicking refresh button. This event doesn't carry any payload.
11531186
# install dependencies
11541187
npm install
11551188

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)
11571190
npm run dev
11581191

11591192
# build for production with minification

0 commit comments

Comments
 (0)