Skip to content

Commit 716742a

Browse files
committed
Merge branch 'develop'
2 parents 8cf3174 + b921be9 commit 716742a

File tree

11 files changed

+238
-98616
lines changed

11 files changed

+238
-98616
lines changed

package-lock.json

Lines changed: 12 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"bootstrap": "^4.1.3",
4040
"chai": "^4.1.2",
4141
"chalk": "^2.0.1",
42+
"chance": "^1.0.18",
4243
"copy-webpack-plugin": "^4.0.1",
4344
"cross-env": "^5.0.1",
4445
"css-loader": "^0.28.0",
@@ -80,10 +81,10 @@
8081
"shelljs": "^0.7.6",
8182
"uglifyjs-webpack-plugin": "^1.1.1",
8283
"url-loader": "^0.5.8",
83-
"vue": "^2.5.2",
84+
"vue": "^2.5.22",
8485
"vue-loader": "^13.3.0",
8586
"vue-style-loader": "^3.0.1",
86-
"vue-template-compiler": "^2.5.2",
87+
"vue-template-compiler": "^2.5.22",
8788
"webpack": "^3.6.0",
8889
"webpack-bundle-analyzer": "^2.13.1",
8990
"webpack-dev-server": "^2.9.1",

src/App.vue

Lines changed: 54 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
<script>
3838
import VueBootstrap4Table from './components/VueBootstrap4Table.vue'
39-
39+
var chance = require('chance').Chance(88);
4040
export default {
4141
name: 'App',
4242
data: function() {
@@ -109,6 +109,17 @@
109109
row_classes: "my-row-class1 my-row-class2",
110110
column_classes: "my-column-class1 my-column-class2"
111111
},
112+
{
113+
label: "Salary",
114+
name: "salary",
115+
// filter: {
116+
// type: "simple",
117+
// placeholder: "Enter email"
118+
// },
119+
sort: true,
120+
row_text_alignment: "text-left",
121+
column_text_alignment: "text-left"
122+
},
112123
{
113124
label: "City",
114125
name: "address.city",
@@ -147,14 +158,25 @@
147158
selected_rows_info: true
148159
},
149160
classes: {
150-
// table : {
151-
// "table-striped my-class" : true,
152-
// "table-bordered my-class-two" : function(rows) {
153-
// return true
154-
// }
155-
// }
161+
table : {
162+
"table-striped my-class" : true,
163+
"table-bordered my-class-two" : function(rows) {
164+
return true
165+
}
166+
},
167+
row : {
168+
"my-row my-row2" : true,
169+
"function-class" : function(row) {
170+
return row.id == 1
171+
}
172+
},
173+
cell : {
174+
"my-cell my-cell2" : true,
175+
"text-danger" : function(row,column,cellValue) {
176+
return column.name == "salary" && row.salary > 2500
177+
}
178+
},
156179
// table : "table-striped table-bordered my-class",
157-
158180
},
159181
// actions: []
160182
actions: [
@@ -177,14 +199,30 @@
177199
},
178200
methods: {
179201
fetchData() {
180-
let self = this;
181-
axios.get('https://raw.githubusercontent.com/rubanraj54/vue-bootstrap4-table/develop/src/assets/toy_data/users_500.json')
182-
.then(function(response) {
183-
self.rows = response.data;
184-
})
185-
.catch(function(error) {
186-
console.log(error);
187-
});
202+
let user;
203+
let users = [];
204+
for (let i = 1; i <=500; i++) {
205+
user = {
206+
id : i,
207+
name: {
208+
first_name: chance.first(),
209+
last_name: chance.last(),
210+
},
211+
age: chance.age(),
212+
address: {
213+
city: chance.city(),
214+
street: chance.address(),
215+
postcode: chance.postcode(),
216+
country: chance.country({ full: true })
217+
},
218+
salary: chance.integer({ min: 1500, max: 3000 }),
219+
email: chance.email(),
220+
website: chance.domain(),
221+
mobile: chance.phone()
222+
}
223+
users.push(user);
224+
}
225+
this.rows = users;
188226
},
189227
onSelectRows(payload) {
190228
console.log(payload);
@@ -256,7 +294,6 @@
256294
mounted() {
257295
let self = this;
258296
this.fetchData();
259-
260297
// let test = [1,2,3,4,5,6,7]
261298
262299
// test.some((val,index) => {

0 commit comments

Comments
 (0)