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
+92-21Lines changed: 92 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,7 @@
5
5
6
6
7
7
8
+
8
9
# 1. vue-bootstrap4-table
9
10
10
11
> Advanced table based on Vue 2 and Bootstrap 4
@@ -885,12 +886,82 @@ Each action object should contain the below attributes.
885
886
| event_name | Name of the event that you want to listen back (Mandatory)| String | undefined |
886
887
| event_payload | Payload you want to send with the event | Any | undefined |
887
888
889
+
# 13. Custom classes
888
890
889
-
# 13. Config
890
-
You can optionally pass config as a prop to **`vue-bootstrap4-table`** component to override the table configuration defaults.
891
+
You can pass your classes for the table, row, cell, etc.. via **`classes`** prop. And interesting thing is you can pass a validator function to apply custom classes conditionally.
891
892
892
893
## 13.1. Example
893
894
```vue
895
+
<template>
896
+
<div id="app">
897
+
<vue-bootstrap4-table :classes="classes"
898
+
:rows="rows"
899
+
:columns="columns">
900
+
</vue-bootstrap4-table>
901
+
</div>
902
+
</template>
903
+
904
+
<script>
905
+
import VueBootstrap4Table from 'vue-bootstrap4-table'
Currently you can add custom classes to **`<table>, <tr> and <td>`** elements using table, row, and cell properties respectively.
945
+
946
+
You can either pass the custom classes directly or pass a function with your condition check to decide whether to apply to class or not.
947
+
948
+
For example, in the above example, look at the property **`cell`**. There we are applying classes **"my-cell my-cell2"** directly to **`<td>`** element and **"text-danger"** class only to the "salary" column & also the salary value should be above 2500.
949
+
950
+
# 14. vbt-classes
951
+
By default, vue-bootstrap-table add classes to table elements which allows users to override the default styles.
952
+
## 14.1. vbt-row-selected
953
+
If a row is being selected with checkbox or row, then the selected row <tr> element will have "vbt-row-selected" class attached to it.
954
+
955
+
```html
956
+
<trclass="vbt-row-selected">
957
+
...
958
+
</tr>
959
+
```
960
+
# 15. Config
961
+
You can optionally pass config as a prop to **`vue-bootstrap4-table`** component to override the table configuration defaults.
@@ -945,7 +1016,7 @@ You can optionally pass config as a prop to **`vue-bootstrap4-table`** component
945
1016
946
1017
> If you don't provide an attribute in the config, then default value will be assigned to that attribute.
947
1018
948
-
## 13.2. Attributes details
1019
+
## 15.2. Attributes details
949
1020
950
1021
|Attributes | Description | type| Default |
951
1022
|--|--|--|--|
@@ -969,11 +1040,11 @@ You can optionally pass config as a prop to **`vue-bootstrap4-table`** component
969
1040
| show_reset_button | Show/Hide Refresh button. Resets all query (sort, filter, global search) currently applied in the table. |Boolean | true |
970
1041
| server_mode | Enable/Disable server side processing (Sorting, Filtering, Global search & pagination) |Boolean | false |
971
1042
972
-
# 14. Server mode
1043
+
# 16. Server mode
973
1044
974
1045
In server mode, client side filtering, sorting, global search and pagination will be disabled. Instead your server will do all this and returns only the processed response. New response will update the rows in the table.
975
1046
976
-
## 14.1. Example
1047
+
## 16.1. Example
977
1048
978
1049
```vue
979
1050
<template>
@@ -1049,7 +1120,7 @@ In server mode, client side filtering, sorting, global search and pagination wil
1049
1120
</style>
1050
1121
```
1051
1122
1052
-
### 14.1.1. Step 1
1123
+
### 16.1.1. Step 1
1053
1124
1054
1125
In your application you should have the below information in **`data.`**
1055
1126
@@ -1064,7 +1135,7 @@ queryParams: {
1064
1135
total_rows:0,
1065
1136
```
1066
1137
1067
-
### 14.1.2. Step 2
1138
+
### 16.1.2. Step 2
1068
1139
1069
1140
If you want to work with pagination, then don't forget to set **`total_rows`** as prop to **`totalRows`**.
1070
1141
@@ -1079,7 +1150,7 @@ Then listen for the event **`on-change-query`**.
1079
1150
</vue-bootstrap4-table>
1080
1151
```
1081
1152
1082
-
### 14.1.3. Step 3
1153
+
### 16.1.3. Step 3
1083
1154
1084
1155
Wherever there is a change in table query params, you will get your new query params in your **`onChangeQuery`** function. With the new values update your **`queryParams`** and fetch new data from server.
0 commit comments