Tree Table - SUM or TOTALS in Sections

Hello,

We have a tree which has rows which need to total in the center of the tree
and at the end.

Like a profit and loss statement we use tree to roll up numbers in to the root category or section.

But need to total each section.

Is this possible?

Comments

  • Hello,

    You can specify the footer for your grouping function, which will calculate the totals of each group:

    view:"treetable",
    scheme:{
        $group:{
          by:"year",
          footer:{
            votes:["votes", "sum"],
            row:function(obj ){
              return "<span style='float:right;'>Total: 
                "+webix.i18n.numberFormat(obj.votes)+"</span>";
              }
            }
        }
    }
    

    and the footer for the needed column which will display the its totals:

    {id:"votes", footer:{"summColumn"}}
    

    Check the following snippet, please: https://webix.com/snippet/91830dcf

  • Hi guys,

    how can I add Sum for each group and for each collumns like this ->
    http://prntscr.com/na5cjb

  • Hi @Dsqwared ,

    The solution will be similar to the example above

    scheme:{
          $group:{
            by:"year",
            footer:{
              votes:["votes", "sum"],
              year:["year", "sum"],
              row:function(obj){ 
                return "<span style='float:left;'>Total :</span><span style='float:right;'> Year: "+webix.i18n.numberFormat(obj.year)+" Votes: "+webix.i18n.numberFormat(obj.votes)+"</span>"; 
              }
            }   
          }   
        },
    

    Check the sample: https://snippet.webix.com/zz4uzz6u

  • edited April 12

    @Nastja Thank you !!!!! Very much!!!

  • You are welcome :)

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!