提交 50d4237b 编写于 作者: K Kevin Nadro

fixed minor bugs

- fixed the input fields to be text for matrix tracers can store
characters and not just numbers
- fixed the output of the 1d tracer array because it was storing it as
a 2d matrix
上级 24b22235
......@@ -35,7 +35,7 @@ const tableToInputFields = (numRows, numColumns) => {
for(var i = 0; i < numRows; i++){
for(var j = 0; j < numColumns; j++){
var elem = document.createElement('input');
elem.type = 'Number';
elem.type = 'Text';
elem.value = Math.floor(Math.random() * 10 + 1);
elem.classList.add('mtbl-col','inputField');
table.childNodes[i].childNodes[j].innerHTML = '';
......@@ -56,14 +56,18 @@ const generateJS = (logger, tracer, tracerName) => {
logger.print('Copy and paste this code in your data.js file!');
logger.print('');
logger.print('let myTable = [');
if(numRows > 1) {
logger.print('let myTable = [');
}
var line = '';
var line = 'let myTable = [';
var i;
var j;
var comma = ',';
for(i = 0; i < numRows; i++){
line = '[';
if(numRows > 1){
line = '[';
}
for(j = 0; j < numColumns-1; j++){
line += table.childNodes[i].childNodes[j].childNodes[0].value + ',';
}
......@@ -71,7 +75,9 @@ const generateJS = (logger, tracer, tracerName) => {
line += table.childNodes[i].childNodes[j++].childNodes[0].value + ']' + comma;
logger.print(line);
}
logger.print(']');
if(numRows > 1){
logger.print(']');
}
logger.print("let myTableTracer = new "+ tracer +" ('"+tracerName+"')");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册