本文介绍了使用colspan合并动态数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我对合并数据有疑问
1.如何使用colspan合并列中的按钮基于动态数据?
以下是表中数据的图像
这里用javascript编写代码:
Hi guys,
I have a question on merging data
1.How to use the colspan to merge the button in column based on the dynamic data?
Here are the image of my data in a table
using colspan
and here the coding for it in javascript:
var DrillStructure = {
"Cutting" : {
"dDom" : "<th>No</th><th>Part Name</th><th>Raw Material</th><th>Order Qty</th><th>Qty</th><th>Marker 's Size</th><th>Req Hrs</th><th>Cutting Start</th><th>Cutting End</th><th>Status</th></tr></thead>",
"link" : "msp/loopForCutting"
},
"Printing" : {
"dDom" : "<th>No</th><th>Part Name</th><th>Order Qty</th><th>Qty</th><th>Colour Print</th><th>Type</th><th>No of Up</th><th>Req Hrs</th><th>Printing Start</th><th>Printing End</th><th>Status</th><th >Action</th></tr></thead>",
"link" : "msp/loopForCutting"
}
};
,这是php代码:
and this is the php code:
// Display the data in the form i wanted
$iloop = 1;
foreach ($rResult->result_array() as $aRow) {
if($department == 'Printing') {
$material = $aRow['material_part'];
$qty = $aRow['qty'];
$demand = $aRow['UPH'];
$colprint = $aRow['colprint'];
$noup = $aRow['noup'];
$reqhrs = ((($colprint * $qty) / $demand) / $noup);
$btn = "<a class='btn' data-mat = \"{$material}\" onclick=\"openPrintingLog(this, 'prnlog','{$iloop}', '{$idschedule}')\"></a>";
$row[0] = $btn;
$row[1] = $material;
$row[2] = $aRow['qty'];
$row[3] = $aRow['prnqty'];
$row[4] = $aRow['colprint'];
$row[5] = $aRow['coltype'];
$row[6] = $aRow['noup'];
$row[7] = number_format($reqhrs,2,'.','');
$row[8] = "<span class='editable' data-from='part' data-field='printingstart' data-id='{$aRow['idschedulepart']}'>{$aRow['printingstart']}</span>";
$row[9] = "<span class='editable' data-from='part' data-field='printingend' data-id='{$aRow['idschedulepart']}'>{$aRow['printingend']}</span>";
$row[10] = $aRow['status'];
$row[11] = "<a class='btn btn-small' onclick='open_wrappers();'>Complete</a>"; //added by hyj
}
$iloop = $iloop + 1;
$output['aaData'][] = $row;
}
提前感谢。
我尝试过:
我一直在寻找如何使用colspan和rowspan,并找到了这个页面,但不知道它是如何工作的。
推荐答案
这篇关于使用colspan合并动态数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!