CREATETABLE

<pre>

function createTable(objs, str_numberDefinition, pindexnr, str_calledit, str_calldelete) {
let nl = '\n';
let n1 = objs.length;
let obj = objs[0];
let captions = [];
for(var j in obj){
let sub_key = j;
let sub_val = obj[j];
//alert(sub_key);
captions.push( sub_key );
}
let n2 = captions.length;

let s='';
s +='<table>' + nl;
s +='<tr>' + nl;
if (str_numberDefinition.length>0) {
s +=' <th>' + str_numberDefinition + '</th>' + nl;
}
for(var i in captions){
let scaption = captions[i];
let sfirst = captions[i].substring(0,1).toUpperCase();
s +=' <th>' + sfirst + scaption.substring(1,scaption.length) + '</th>' + nl;
}
if (str_calledit!='') {
s +=' <th>' + '-' + '</th>' + nl;
}
if (str_calldelete!='') {
s +=' <th>' + '-' + '</th>' + nl;
}
s +='</tr>' + nl;

for (let i in objs) {
s +='<tr>' + nl;
if (numberDefinition.length>0) {
s +=' <td>' + (i+1) + '</td>' + nl;
}
let obj = objs[i];
for(var j in obj){
s +=' <td>' + obj[j] + '</td>' + nl;
}
if (str_calledit!='') {
s+=' <td class="tdbutton">' + '<input type="button" value="Edit" onclick="'+str_calledit+'(' + obj[pindexnr] + ')"/>' + '</td> ' + nl;
}
if (str_calldelete!='') {
s+=' <td class="tdbutton">' + '<input type="button" value="Delete" onclick="'+str_calldelete+'(' + obj[pindexnr] + ')"/>' + '</td> ' + nl;
}

s +='</tr>' + nl;
}

s +='</table>' + nl;
return s;
}

</pre>




Web-Technologien
jquery DOM