EasyUI Forum
May 16, 2024, 10:10:49 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Pivot Grid Totals  (Read 10637 times)
akashana
Newbie
*
Posts: 23


View Profile
« on: March 20, 2019, 07:52:30 PM »

Hi,

Pivot grid was generated perfectly as shown in attachment with the following source data.
[
  {
    "Name": "Employee 1001",
    "Period": "Jan-18",
    "Amount": 6504
  },
  {
    "Name": "Employee 1001",
    "Period": "Jan-18",
    "Amount": 4648
  }....]

However, I am stuck at displaying column total and row total i.e. Total for each month and Total for each employee. Can you please help ?

Regards,
Logged
akashana
Newbie
*
Posts: 23


View Profile
« Reply #1 on: March 20, 2019, 07:56:43 PM »

Somehow the attachment was missing in my earlier post.
Logged
akashana
Newbie
*
Posts: 23


View Profile
« Reply #2 on: March 25, 2019, 02:53:03 AM »

Hi,

Any update on this ?

Regards,
Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #3 on: March 25, 2019, 08:27:01 AM »

What is the 'column total and row total'? Please describe it much clearly.
Logged
akashana
Newbie
*
Posts: 23


View Profile
« Reply #4 on: March 25, 2019, 09:07:04 PM »

Hi,

Please see the attached image for totals.

Regards,
Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #5 on: March 26, 2019, 12:44:32 AM »

The 'aggregate' property is available to set the summary row and column. Make sure to download the newest  file from https://www.jeasyui.com/extension/pivotgrid.php

Code:
pivot:{
    rows:['Country','Category'],
    columns:['Color'],
    values:[
        {field:'Price',op:'max'},
        {field:'Discount',op:'sum'}
    ],
    aggregate: {
        column: {
            field: '_total',
            title: 'Total',
            width: 100,
            align: 'right'
        },
        footer: {
            frozenColumnTitle: 'Total'
        }
    }
},
Logged
akashana
Newbie
*
Posts: 23


View Profile
« Reply #6 on: March 27, 2019, 05:24:13 AM »

Hi,

I downloaded the latest file but it seems that aggregate functionality doesn't work. Even in the sample file pivotgrid.html, the code for totals is not included.

Can you please share a working example ?

Thanks & Best Regards,

Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #7 on: March 27, 2019, 08:48:07 AM »

Please look at this example https://www.jeasyui.com/demo/test/test6.html
Logged
akashana
Newbie
*
Posts: 23


View Profile
« Reply #8 on: March 27, 2019, 07:25:29 PM »

Hi,

Thanks. But this aggregate property didn't work in the version I downloaded from https://www.jeasyui.com/extension/downloads/jquery-easyui-pivotgrid.zip. Did I download it from wrong location ?

Satisfied with your controls and bought one commercial license just now.

One question. If there is only one dimension for aggregation, can I hide it ? See image

Best Regards,
Logged
akashana
Newbie
*
Posts: 23


View Profile
« Reply #9 on: March 27, 2019, 08:08:05 PM »

Hi,

Noticed one small issue. FrozenColumnTitle is not displayed. Please see image.

Regards,
Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #10 on: March 28, 2019, 02:42:52 AM »

Set the 'frozenColumnTitle' property correctly to display the frozen column title. Download the extension from https://www.jeasyui.com/extension/downloads/jquery-easyui-pivotgrid.zip. The example 'pivotgrid.html' in the zip file shows how to set 'aggregate' property.
Logged
akashana
Newbie
*
Posts: 23


View Profile
« Reply #11 on: March 28, 2019, 05:00:39 AM »

Hi,

It's done. I handled using the following code.

onLoadSuccess: function(){
               $('#pg').pivotgrid('collapseAll');
               var opt = $('#pg').pivotgrid('options');
               var rows = opt.pivot.rows;
               var header = rows[0];
               var title = $(this).data('datagrid').dc.header1.find('.datagrid-cell>span:first');
               title.html('<span style="font-weight:bold">'+ header +'</span>');
            }

You may close the ticket.

Regards,
Logged
nijino
Newbie
*
Posts: 1


View Profile
« Reply #12 on: August 12, 2019, 07:31:38 PM »

Hello,

i download jquery-easyui-pivotgrid.zip and test it.
the total is the correct value * numbers of rows

jquery.pivotgrid.js
i modify the line #123, footerRow[fields] = value / opts.pivot.rows.length;

Please help to check if this the correct fix.


Thanks.
Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #13 on: August 13, 2019, 01:16:17 AM »

No problem with this code.
Code:
footerRow[fields[i]] = value;
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!