Skip to content

Commit 25c4cb4

Browse files
author
Kevin Nadro
committed
2dmatrix tracer created!
creates a 2dmatrix tracer with input values on it.
1 parent bef9e8f commit 25c4cb4

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

css/stylesheet.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,3 +673,7 @@ input[type=number]::-webkit-outer-spin-button {
673673
z-index: 100;
674674
background-color: white;
675675
}
676+
677+
.inputField{
678+
width: 16px;
679+
}

js/create/index.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,26 @@ const fauxData = (r, c) => {
2626
return arr;
2727
};
2828

29+
const makeInputFields = () =>{
30+
31+
var table = document.querySelector('.mtbl-table');
32+
33+
var numRows = getNumRows();
34+
var numColumns = getNumColumns();
35+
36+
for(var i = 0; i < numRows; i++){
37+
for(var j = 0; j < numColumns; j++){
38+
var elem = document.createElement('input');
39+
elem.type = 'Number';
40+
elem.value = 1;
41+
elem.classList.add('mtbl-col','inputField');
42+
table.childNodes[i].childNodes[j].innerHTML = '';
43+
table.childNodes[i].childNodes[j].appendChild(elem);
44+
}
45+
}
46+
47+
};
48+
2949
const setupButtons = () => {
3050

3151
var button_2DMatrix = document.getElementById("button-2DMatrix");
@@ -34,8 +54,9 @@ const setupButtons = () => {
3454
var numRows = getNumRows();
3555
var numColumns = getNumColumns();
3656
var data = fauxData(numRows, numColumns);
37-
console.log(data);
57+
3858
arr2DTracer.setData(data);
59+
makeInputFields();
3960
},false);
4061
};
4162

0 commit comments

Comments
 (0)