Vue.js - When grouping, I need to make formula

Posted by: rodrigo.oliveira on 26 February 2021, 2:40 pm EST

    • Post Options:
    • Link

    Posted 26 February 2021, 2:40 pm EST - Updated 3 October 2022, 2:23 pm EST

    When grouping, I have the totalizers in the grid, but it is not a sum, avg, …, I need to make a formula with the totals (example GROUP_C = SUM_GROUP (A) / SUM_GROUP (B). Attached is an image with the example.

    Below, code snippet

    <wj-flex-grid

    ref = “gridData”

    : show-selected-headers = “‘All’”

    : show-marquee = “true”

    : sticky-headers = “true”

    : items-source = “data”

    : allow-merging = “‘Cells’”

    : is-read-only = “true”

    : headers-visibility = “1”

    : alternating-row-step = “0”

    : auto-generate-columns = “false”

    : initialized = “initializeGrid”

    : selection-changed = “selectionChanged”

    : group-header-format = “‘ {value} ({count} items)’”

    style = “width: 100%; border-radius: 0”

    class = “grid”

    @ mouseover.native = “mouseOver”

    >

          <wj-flex-grid-column
            v-for = "col in confColumns"
            : key = "col.header"
            : col = "col"
            : binding = "col.binding"
            : header = "col.header"
            : width = "col.width"
            : min-width = "col.minwidth"
            : format = "col.format"
            : align = "col.align"
            : aggregate = "col.aggregate"
            : visible = "col.visible"
            : is-read-only = "col.isReadOnly"
          />
        </wj-flex-grid>
    

  • Posted 1 March 2021, 8:59 am EST

    Hi,

    You may use the formatItem event to set the custom aggregate. Please refer to the following demo which demonstrates the same:

    https://www.grapecity.com/wijmo/demos/Grid/Aggregation/Customaggregation/vue

    In the demo, the aggregate of profit column is calculated dynamically.

    Regards

    Sharad

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels