reDrawRow
detailTable.reDrawRow()
sumDetailTableField
function sumDetailTableField (detailTable, field) {
return detailTable.getData().reduce((sum, row) => {
return gUtil.precise(sum, row[field], '+')
}, 0)
}
batchSetDataValue
function batchSetDataValue (detailTable, fieldName, value) {
detailTable.getData().forEach(row => {
detailTable.setDataValue(row[detailTable.BILL_BATCH], fieldName, value)
})
}
detailTable.getData().forEach(row => {
detailTable.setDataValue(row[detailTable.BILL_BATCH], fieldName, value)
})
cleanColumn
function cleanColumn (detailTable, ...fieldNames) {
fieldNames.forEach(fieldName => {
detailTable.setColumnVisible(fieldName, false)
detailTable.getData().forEach(row => {
detailTable.setDataValue(row[detailTable.BILL_BATCH], fieldName, null)
})
})
}
子列表input控制
const observer = new MutationObserver((mutations, observer) => {
for (let mutation of mutations) {
if (mutation.type === 'childList') {
mutation.addedNodes.forEach(function(node) {
if (node.nodeType === Node.ELEMENT_NODE && node.tagName.toLowerCase() === 'input') {
if (node.parentNode && node.parentNode.getAttribute('col-id') == 'col-id') {
node.setAttribute('maxlength', '10')
}
}
})
}
}
})
observer.observe(detailTable.findHtmlDocument('div.ag-center-cols-container')[0], {childList: true, subtree: true})