【发布时间】:2017-03-08 05:01:32
【问题描述】:
我想从 html 表中创建一个自定义数组... 在 Html 表中,我有 6 列。我想制作前 5 列的数组 我只想获取文本数组,我不想在该数组中包含 Button,表格为 6*6
var array = [];
var headers = [];
$('#tbl1 th').each(function(index, item) {
headers[index] = $(item).html();
});
$('#tbl1 tr').has('td').each(function() {
var arrayItem = {};
$('td', $(this)).each(function(index, item) {
arrayItem[headers[index]] = $(item).text();
});
debugger;
array.push(arrayItem);
});
alert(array);
$("#gridContainer").dxDataGrid({
dataSource: array
});
【问题讨论】:
-
您好,请添加html表结构
-
为什么需要第二个内联循环?
-
基本上我想从这个表中创建数组,然后想将该数组作为数据源发布到 DevExtreme GridView