var descriptionInput;
var tbl = document.getElementById('21.125-mrss-cont-none-content');
Array.from(tbl.getElementsByTagName('tr')).forEach(function(tr) {
Array.from(tr.querySelectorAll("input[name$='6#if']")).forEach(function(input) {
input.onkeypress = function(e) {
if (e.keyCode == 13) {
descriptionInput = input.value;
input.value = descriptionInput;
document.getElementById('__AGIM0:U:1:4:2:1:1::0:14').value = descriptionInput;
}
console.log(descriptionInput);
}
});
});
// if value of __AGIM0:U:1:4:2:1:1::0:14 != New Item can add new row to top of table.
// get table
var table = document.getElementById('DYN_6000-LISTSAPLMEGUI-tab');
var t = table.rows.length;
//getting current blank cell ID and upping the blank cell ID to the new last cell
var new_cell_id = table.rows.item(t - 1).id;
var old_cell_id = "DYN_6000-LISTSAPLMEGUI-key-" + t;
table.rows.item(t - 1).id = old_cell_id;
table.rows.item(t - 1).onmouseover = function() {
showItemDetailDropDown_hover(old_cell_id);
};
table.rows.item(t - 1).onmouseout = function() {
showItemDetailDropDown_hover(old_cell_id);
};
table.rows.item(t - 1).onclick = function() {
showItemDetailDropDown_click(old_cell_id);
};
//create new row and table
var drop_down_height = document.getElementById('DYN_6000-LISTSAPLMEGUI-scrl').style.height;
document.getElementById('DYN_6000-LISTSAPLMEGUI-scrl').style.height = (parseInt(drop_down_height.replace("px", "")) + 18) + "px";
var new_row = table.insertRow(t - 1);
var new_cell = new_row.insertCell(0);
new_row.insertCell(1);
//set new row and cell properties
new_row.id = new_cell_id;
new_row.classList.add('urNoUserSelect');
new_row.style.width = "100%";
new_row.style.height = "18px";
new_row.onmouseover = function() {
showItemDetailDropDown_hover(new_cell_id);
};
new_row.onmouseout = function() {
showItemDetailDropDown_hover(new_cell_id);
};
new_row.onclick = function() {
showItemDetailDropDown_click(new_cell_id);
};
new_cell.classList.add('urIlb2I');
new_cell.classList.add('urColorTxtStandard');
var new_item = t;
new_cell.innerHTML = "[ " + new_item + " ]";
var zyx = "grid#21.125#" + row + ",2#if";
document.getElementById(zyx).value = new_item;
document.getElementById('__AGIM0:U:1:4:2:1:1::0:14').value = new_cell.innerHTML;
checkButton('keyboard');
第一个函数从列中的每一行(descriptionInput)获取输入。第二部分从JS中的表构建一个项目下拉菜单。下拉菜单显示[1] - [10],具体取决于用户输入信息的行。如何将用户输入添加到标签,如
[1] descriptionInput ?
输入应该在“new_cell.innerHTML”之后,并添加到底部带有长ID的标签(“AGIM0:”) 我想我可以在将值写入字段并将其设置为字符串之前创建一个字符串,或者执行item [x] .itemnumber + item [x] .descriptionInput但我不知道如何编写它正确。