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
|
...
function addDatagridCell(row, index, property, styleClass, type, values) {
var newCell = row.insertCell(row.cells.length);
newCell.className = styleClass;
if (type=="empty") {
if (values!=null && values!="") {
eval(values + "(newCell,index)");
}
} else {
var inputElementName = type=="select"? "SELECT" : "INPUT";
var input = document.createElement(inputElementName);
if (type!="select") {
input.setAttribute('type', type==null ? "text" : type);
}
input.setAttribute('name', property + "[" + index + "]");
if (type=="checkbox") {
input.setAttribute('value', "true");
} else if (type=="select") {
for (i=0;i<values.length; i++) {
var option = document.createElement("OPTION");
option.setAttribute("value", values[i].value);
option.innerHTML = values[i].label;
input.appendChild(option);
}
} else {
input.setAttribute('value', "");
}
newCell.appendChild(input);
}
return newCell;
}
... |
Partager