<script>
var data1 = new Array();//最终要取得的json对象
var change = function(obj, cell, value) {
//取得Excel每个单元格内容
$(".jexcel").find("tr").each(function (i, v) {
var tdArray = $(this).children();
if (i == 0)
return true;//跳出表头,进行下次循环
var p = new Object();
p.No = $.trim(tdArray.eq(0).html());
p.Ip = $.trim(tdArray.eq(1).html());
data1.push(p);
});
console.log(data1)
}
$('#spreadsheet').jexcel({
colHeaders: [ ],
colWidths: [],
onchange: change,
columns: [
{ type: 'text'},
{ type: 'text' },
{ type: 'dropdown', source:[ {'id':'1', 'name':'switch'}, {'id':'2', 'name':'router'}, {'id':'3', 'name':'firewall'} ] },
{ type: 'dropdown', },
{ type: 'text' },
],
minDimensions:[10,5],
});
</script>