Hallo Axel,
soweit mir bekannt, werden im $rows array() nur Zeilenwerte gespeichert:
z.B.:
[0] => Array
(
[id] => 2
[name_full] => ddddd
[name_short] =>
[comments] =>
[type] => 1
[creator] => 5
[created] => 1549998067
[modifier] => 5
[modified] => 1549998067
[is_active] =>
)
[1] => Array
(
[id] => 1
[name_full] => ddddd
[name_short] =>
[comments] =>
[type] => 1
[creator] => 5
[created] => 1549997940
[modifier] => 5
[modified] => 1549997940
[is_active] =>
)
Diese kann man auch über die get_rows Funktion ändern.
Ich glaube nicht dass man damit die Spalten Titel manipulieren kann.
Wir haben in einer App Spalten Summen im Header, die je na Filter aktualisiert werden. Das haben wir mit entsprechenden ajax Funktionen geloest. Das sieht dann so aus:
- Im Nextmatch Header die Felder hinzufügen:
<nextmatch-sortheader label="C2" id="costs2" />
<nextmatch-sortheader label="R2" id="result2" />
<nextmatch-sortheader label="R2%" id="result2_perc" />
<description label="C2: " id="sum[costs2]" align="right" />
<description label=" R2:" id="sum[result2]" align="right" class="bold"/>
<description label=" (" id="sum[result2_perc]" align="right"/>
<description label="%)" align="right"/>
</hbox>
- in app.js die Filteränderung abfangen, und die Ajax Funktionen aufrufen
onApplyFilters: function (template) {
if (template == 'acerp.index')
var func = 'acerp.acerp_ajax.ajax_calcTotals';
else if (template == 'acerp.lines.index')
var func = 'acerp.acerp_lines_ui.ajax_calcTotals';
else
return;
var query = app.acerp.et2.getWidgetById('nm').activeFilters;
egw.json(func, [query], function (totals) {
if (template == 'acerp.index') {
for (var prop in totals)
app.acerp.et2.getWidgetById('sum[' + prop + ']').set_value(totals[ prop ]);
} else {
var id1 = 'total_qty1';
var id2 = 'total_amount';
app.acerp.et2.getWidgetById(id1).set_value(totals.amount1);
app.acerp.et2.getWidgetById(id2).set_value(totals.amount2);
}
}).sendRequest(true);
if (template == 'acerp.index') {
egw.json('acerp.acerp_ajax.ajax_calcCarryTotals', [query], function (totals) {
if (totals.exists) {
jQuery('.carryclass').show();
for (var prop in totals.sum)
app.acerp.et2.getWidgetById('sum[' + prop + ']').set_value(totals.sum[ prop ]);
} else {
jQuery('.carryclass').hide();
}
}).sendRequest(true);
}
},
3… Die Ajax Funtionen in php sehen wie folgt aus
function ajax_calcTotals($query) {
$query['order'] = '';
$result = $this->get_totals_formated($query);
//error_log( print_r( $result , true ) );
Api\Json\Response::get()->data($result);
}
function ajax_calcCarryTotals($query) {
$totals = $this->get_totals($query);
$sum = $totals['amount'];
$sum_hours = $totals['hours'];
list( $amount, $hours ) = $this->get_carry_totals($query);
$result = array(
'exists' => ($amount !== NULL),
'sum' => array(
'amount_carry' => Etemplate::number_format($amount),
'amount_total' => Etemplate::number_format($amount + $sum),
'hours_carry' => Etemplate::number_format($hours),
'hours_total' => Etemplate::number_format($hours + $sum_hours),
)
);
Api\Json\Response::get()->data($result);
}
Vielleicht hilft Dir das weiter
VG
Alexandros