Datatable Footer with calculated values

Hello,

I need the footer showing the right values... Is there a way?
https://snippet.webix.com/grnpggim

Thanks,
Martin

Comments

  • edited August 10

    https://snippet.webix.com/w2njk0et

    also you can implement own footer calculation algorithm.

    e.g. balance calculation

    webix.ui.datafilter.balanceColumn = webix.extend({
        refresh: function(master, node, value) {
            var result = 0, _val;
            var prefix = value.columnId.substr(0, value.columnId.length - 7);
            master.data.each(function(obj) {
                if (!obj || obj.$group || obj.$footer) return;
                _val = (obj[prefix + "Debit"] || 0) * 1 - (obj[prefix + "Credit"] || 0) * 1;
                if (isFinite(_val)) result += _val;
            });
            if (value.format)
                result = value.format(result);
            if (value.template)
                result = value.template({ value: result });
            node.firstChild.style.textAlign = "right";
            node.firstChild.innerHTML = result;
        }
    }, webix.ui.datafilter.summColumn);
    
  • Hello!
    And thanks for your message.
    I have a unfortunately more complicated sample
    and it is the combination with this discussion
    https://forum.webix.com/discussion/32864/datatable-insert-several-new-columns-and-values#latest

    Here is what I would need:
    https://snippet.webix.com/riwuev87

    The footer should show the right value.

    Thanks again!
    Martin

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!