* [bug] fix total row drill.
This commit is contained in:
@@ -61,19 +61,27 @@ class pivotTable extends wg
|
||||
if(empty($onRenderCell)) $onRenderCell = jsRaw(<<<JS
|
||||
function(result, {row, col})
|
||||
{
|
||||
if(result && col.setting.colspan)
|
||||
if(result)
|
||||
{
|
||||
let values = result.shift();
|
||||
if(typeof(values.type) != 'undefined' && values.type == 'a') values = values.props['children'];
|
||||
|
||||
result.push({className: 'gap-0 px-0'});
|
||||
values.forEach((value, index) =>
|
||||
result.push({
|
||||
html: value || !Number.isNaN(value) ? `\${value}` : ' ',
|
||||
let values = result.shift();
|
||||
let isDrill = row.data.isDrill[col.name];
|
||||
if(col.setting.colspan && typeof(values.type) != 'undefined' && values.type == 'a')
|
||||
{
|
||||
values = values.props['children'];
|
||||
result.push({className: 'gap-0 p-1'});
|
||||
values.forEach((value, index) =>
|
||||
result.push({
|
||||
html: value || !Number.isNaN(value) ? (isDrill && index == 0 ? "<a href='#'>" + `\${value}` + '</a>' : `\${value}`) : ' ',
|
||||
className: 'flex justify-center items-center h-full w-1/2' + (index == 0 ? ' border-r': ''),
|
||||
style: 'border-color: var(--dtable-border-color)'
|
||||
})
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!isDrill && values?.type == 'a') values = values.props.children;
|
||||
result.push(values);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
+1
-1
@@ -2014,7 +2014,7 @@ class biModel extends model
|
||||
$rows[$rowKey][$field] = $value;
|
||||
$drillFields = $this->getDrillFields($rowKey, $columnKey, $drills);
|
||||
$drillConditions[$field] = $this->processDrills($field, $drillFields, $columns);
|
||||
$isDrill[$field] = isset($columns[$field]['link']);
|
||||
$isDrill[$field] = isset($columns[$field]['link']) && $totalColspan === 0;
|
||||
|
||||
if(is_string($value)) $columnMaxLen[$field] = max($columnMaxLen[$field], mb_strlen($value));
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ window.clickCell = function(col, {colName, rowInfo})
|
||||
let status = 'published';
|
||||
|
||||
if(Array.isArray(value)) value = value[0];
|
||||
value = (value + '').replace('%', '');
|
||||
|
||||
if(Array.isArray(drillConditions) && drillConditions.length)
|
||||
{
|
||||
|
||||
@@ -185,28 +185,29 @@ function diffDate(date1, date2)
|
||||
*/
|
||||
renderCell = function(result, {row, col})
|
||||
{
|
||||
if(result && col.setting.colspan)
|
||||
if(result)
|
||||
{
|
||||
let values = result.shift();
|
||||
let isDrill = false;
|
||||
if(typeof(values.type) != 'undefined' && values.type == 'a')
|
||||
let isDrill = row.data.isDrill[col.name];
|
||||
if(col.setting.colspan && typeof(values.type) != 'undefined' && values.type == 'a')
|
||||
{
|
||||
values = values.props['children'];
|
||||
if(typeof(row.data['field0_colspan']) == 'undefined') isDrill = true;
|
||||
result.push({className: 'gap-0 p-1'});
|
||||
values.forEach((value, index) =>
|
||||
result.push({
|
||||
html: value || !Number.isNaN(value) ? (isDrill && index == 0 ? "<a href='#'>" + `${value}` + '</a>' : `${value}`) : ' ',
|
||||
className: 'flex justify-center items-center h-full w-1/2' + (index == 0 ? ' border-r': ''),
|
||||
style: 'border-color: var(--dtable-border-color)'
|
||||
})
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!isDrill && values?.type == 'a') values = values.props.children;
|
||||
result.push(values);
|
||||
}
|
||||
|
||||
result.push({className: 'gap-0 px-0'});
|
||||
values.forEach((value, index) =>
|
||||
result.push({
|
||||
html: value || !Number.isNaN(value) ? (isDrill && index == 0 ? "<a href='#'>" + `${value}` + '</a>' : `${value}`) : ' ',
|
||||
className: 'flex justify-center items-center h-full w-1/2' + (index == 0 ? ' border-r': ''),
|
||||
style: 'border-color: var(--dtable-border-color)'
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
if(typeof(row.data['field0_colspan']) != 'undefined' && !Array.isArray(row.data[col.name])) result[0] = row.data[col.name];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user