web123456

Bootstrap merge table is inconsistent, and the for loop sequence is trapped

// Merge table: The same value as a column: Merge tablefunction mergeCells(data, fieldName, colspan, target, fieldList) {//Total data group, column name, table name id, merge item attribute name name var sortMap= {}; for (var i = 0; i < ; i++) { for (var prop in data[i]) { var fieldArr = ("."); getCount(data[i], prop, fieldArr, 0, sortMap); } } var index = 0; for (var prop in sortMap) { var count = sortMap[prop]; for (var i = 0; i < ; i++) { $(target).bootstrapTable('mergeCells', { index: index, field: fieldList[i], colspan: colspan, rowspan: count }); } index += count; } } function getCount(data, prop, fieldArr, index, sortMap) { if (index == - 1) { if (prop == fieldArr[index]) { var key = '.'+data[prop];//Convert the type to sort the numbers in the order they are createdif ((key)) { sortMap[key] = sortMap[key] + 1; } else { sortMap[key] = 1; } } return; } if (prop == fieldArr[index]) { var sdata = data[prop]; index = index + 1; getCount(sdata, fieldArr[index], fieldArr, index, sortMap); } }