jQWidgets Forums

jQuery UI Widgets Forums Grid SubTotal in grouping

This topic contains 6 replies, has 4 voices, and was last updated by  Dimitar 9 years, 10 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • SubTotal in grouping #21551

    Lee
    Participant

    Hi

    How to make a subtotal of Total(Price * Quantity) och quantity in grouping efter example Product Name? Tks!

    Regards
    Lee

    SubTotal in grouping #21591

    Dimitar
    Participant

    Hello Lee,

    Here is the modified function groupsrenderer of the demo Groups Renderer:

    var groupsrenderer = function (text, group, expanded, data) {
    if (data.groupcolumn.datafield == 'price' || data.groupcolumn.datafield == 'quantity') {
    if (data.subItems.length > 0) {
    var aggregateP = this.getcolumnaggregateddata("price", ['sum'], false, data.subItems);
    var aggregateQ = this.getcolumnaggregateddata("quantity", ['sum'], true, data.subItems);
    var aggregate = new Object();
    aggregate.sum = aggregateP.sum * aggregateQ.sum;
    }
    else {
    var rows = new Array();
    var getRows = function (group, rows) {
    if (group.subGroups.length > 0) {
    for (var i = 0; i < group.subGroups.length; i++) {
    getRows(group.subGroups[i], rows);
    }
    }
    else {
    for (var i = 0; i < group.subItems.length; i++) {
    rows.push(group.subItems[i]);
    }
    }
    }
    getRows(data, rows);
    var aggregate = this.getcolumnaggregateddata(data.groupcolumn.datafield, ['sum'], true, rows);
    }
    return '<div class="' + toThemeProperty('jqx-grid-groups-row') + '" style="position: absolute;"><span>' + text + ', </span>' + '<span class="' + toThemeProperty('jqx-grid-groups-row-details') + '">' + "Total" + ' (' + aggregate.sum + ')' + '</span></div>';
    }
    else {
    return '<div class="' + toThemeProperty('jqx-grid-groups-row') + '" style="position: absolute;"><span>' + text + '</span>';
    }
    }

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    SubTotal in grouping #21595

    Lee
    Participant

    Thanks, Dimitar, it works.

    Regards,
    Lee

    SubTotal in grouping #31158

    ssp
    Participant

    Hi Dimitar,

    Even though I am able to sum up the grouped data using jqwidgets Grouping and Aggregates, I am supposed to display functionality of subtotal which we can see in excelsheet,

    I want to do like this
    taskA 1 5 3
    taskA 4 8 5
    sum 5 13 8
    taskB 8 1 0
    taskB 1 5 8
    sum 9 6 8

    I am trying to obtain the jqxgrid as in the following example:

    Is this work around do able?

    Thanks & Regards,

    ssp

    SubTotal in grouping #31230

    Dimitar
    Participant

    Hello ssp,

    These subtotals can be calculated with aggregates and displayed in the group headers (as shown in the example). However, they cannot be displayed on separate rows, unfortunately.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    SubTotal in grouping #73034

    drv232
    Participant

    Hi Dimitar, can we now display aggregates in the separate rows.
    I figured there might have been developments over two years. Thanks

    SubTotal in grouping #73047

    Dimitar
    Participant

    Hi drv232,

    Unfortunately, this functionality is still not available and is not currently in our development plans.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.