function DataBind(dataList) {
alert('working' + dataList.length);
var SetData = $("#setdata");
SetData.empty();
for (var a = 0; a < dataList.length; a++) {
var data = "<tr >" +
"<th>" + dataList[a].Item_code + "</th>" +
"<th id='ItmNm'>" + dataList[a].Item_Name + "</th>" +
"<th>1</th> <th><button type='button' onclick='addItem(" + dataList[a].Item_code + ")' class='btn btn-primary'> <span class='glyphicon glyphicon-plus'/></button> <button type='button' class='btnSelect' class='btn btn-primary'> <span class='glyphicon glyphicon-minus'/></button></th>"
+ "</tr>";
// alert(dataList[a].Acc_Cd);
SetData.append(data);
}
}
function addItem(val) {
//var theTbl = document.getElementById("myTable");
//for (var i = 0; i < theTbl.length; i++) {
// for (var j = 0; j < theTbl.rows[i].cells.length; j++) {
// theTbl.rows[i].cells[j] = alertInnerHTML;
// }
//}
alert(val);
var table2 = $("#setfinaldata");
table2.empty();
var Newdata = "<tr>" +
"<th>" + val + "</th>" +
"<th> 1 </th>" +
"<th>1</th>"
+ "</tr>";
table2.append(Newdata);
}
在此代码变量 val 显示警报时的项目代码但未显示项目名称
白猪掌柜的
跃然一笑
相关分类