Skip to content

Commit ad48d64

Browse files
committed
examples.grid.bigData.MainStore: random firstnames & lastnames #6215
1 parent db4d0ee commit ad48d64

1 file changed

Lines changed: 74 additions & 3 deletions

File tree

examples/grid/bigData/MainStore.mjs

Lines changed: 74 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,70 @@ class MainStore extends Store {
2626
model: Model
2727
}
2828

29+
firstnames = [
30+
'Ashley',
31+
'Barbara',
32+
'Betty',
33+
'Chris',
34+
'David',
35+
'Elizabeth',
36+
'Jack',
37+
'James',
38+
'Jennifer',
39+
'Jessica',
40+
'Joe',
41+
'John',
42+
'Karen',
43+
'Kelly',
44+
'Kim',
45+
'Linda',
46+
'Lisa',
47+
'Mary',
48+
'Max',
49+
'Michael',
50+
'Nancy',
51+
'Patricia',
52+
'Rich',
53+
'Robert',
54+
'Sam',
55+
'Sandra',
56+
'Sarah',
57+
'Susan',
58+
'Thomas',
59+
'Tobias'
60+
]
61+
62+
lastnames = [
63+
'Anderson',
64+
'Brown',
65+
'Davis',
66+
'Garcia',
67+
'Gonzales',
68+
'Harris',
69+
'Hernandez',
70+
'Jackson',
71+
'Johnson',
72+
'Jones',
73+
'Lee',
74+
'Lopez',
75+
'Martin',
76+
'Martinez',
77+
'Miller',
78+
'Moore',
79+
'Perez',
80+
'Rahder',
81+
'Rodriguez',
82+
'Smith',
83+
'Taylor',
84+
'Thomas',
85+
'Thompson',
86+
'Uhlig',
87+
'Waters',
88+
'White',
89+
'Williams',
90+
'Wilson'
91+
]
92+
2993
/**
3094
* Triggered after the amountColumns config got changed
3195
* @param {Number} value
@@ -58,13 +122,20 @@ class MainStore extends Store {
58122
* @returns {Object[]}
59123
*/
60124
generateData(amountRows, amountColumns) {
61-
let records = [],
62-
row = 0,
125+
let me = this,
126+
amountFirstnames = me.firstnames.length,
127+
amountLastnames = me.lastnames.length,
128+
records = [],
129+
row = 0,
63130
column, record;
64131

65132
for (; row < amountRows; row++) {
66133
column = 1;
67-
record = {id: row + 1, firstname: 'Tobias', lastname: 'Uhlig'};
134+
record = {
135+
id : row + 1,
136+
firstname: me.firstnames[Math.floor(Math.random() * amountFirstnames)],
137+
lastname : me.lastnames[ Math.floor(Math.random() * amountLastnames)]
138+
};
68139

69140
for (; column < amountColumns - 2; column++) {
70141
record['number' + column] = Math.round(Math.random() * 10000)

0 commit comments

Comments
 (0)