-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.js
More file actions
68 lines (51 loc) · 2.39 KB
/
Copy pathinit.js
File metadata and controls
68 lines (51 loc) · 2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// Made excel grid ui using js
let topRow = document.querySelector(".top-row");
let str = "";
for (let i = 0; i < 26; i++) {
str += `<div class='col top-col'>${String.fromCharCode(65 + i)}</div>`;
}
topRow.innerHTML = str;
let leftCol = document.querySelector(".left-col");
str = ""
for (let i = 0; i < 100; i++) {
str += `<div class='left-col_box'>${i + 1}</div>`
}
leftCol.innerHTML = str;
// 2d array*******************************************************************************************************************************************************************************************************************************************************
let grid = document.querySelector(".grid");
str = "";
for (let i = 0; i < 100; i++) {
str += `<div class="row">`
for (let j = 0; j < 26; j++) {
str += `<div class='col' rid=${i} cid=${j} contenteditable="true"></div>`
}
str += "</div>";
}
grid.innerHTML = str;
//********************************************************************************************************************************************************
//sheet database************************************************************************************************************************************************************************************************************************************************************************************************************************
worksheetDb = []; //made global
function initCurrentSheetDb() { //every time new sheet is created
let sheetDb = [];
for (let i = 0; i < 100; i++) {//100 coloumns
let row = []; // will store rows of 26 coloumns each
for (let j = 0; j < 26; j++) {//26 columns
let cell = { //object having default properties for each cell
halign: "left",
//sets blank values everytime new sheet databse is created
value: "",
fontFamily:"Arial",
fontSize:20,
bold:false,
italic:false,
underline:false,
children: [], //holds every cell which uses this cell for formula
formula: "" //formula which decides value of this cell
}
row.push(cell); //push 26 cells in the row
}
sheetDb.push(row); // push 100 rows in sheetDb
}
worksheetDb.push(sheetDb);
}
initCurrentSheetDb();