Author Topic: column calculation  (Read 3578 times)

virendraparade01

  • Newbie
  • *
  • Posts: 9
    • View Profile
column calculation
« on: August 12, 2019, 07:32:34 pm »
Hello Paramveer,
can u plz let me know what is the issue here in the code related to the column "Confirmed Quantity" calculation where I just fill the quantity for specific item. but can get the total at bottom of column.

 The row is generated at the bottom can changes don't get reflected

Jsfiddle Link: https://jsfiddle.net/virendraparade01/3a1zqvkt/2/.


paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: column calculation
« Reply #1 on: August 13, 2019, 09:03:43 am »
Rows in summary data should be in same format as those of data rows in grid.

Code: [Select]
totalData = { ConfirmedQuantity: revenueTotal};

https://jsfiddle.net/putgbymo/

Example to calculate aggregates at bottom:

https://paramquery.com/pro/demos/summary_json
« Last Edit: August 13, 2019, 09:05:54 am by paramvir »

virendraparade01

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: column calculation
« Reply #2 on: August 13, 2019, 10:26:57 am »
can I Hide the button of attachments in row of Total

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: column calculation
« Reply #3 on: August 13, 2019, 11:28:41 am »
attachments button is hidden in Total row: https://jsfiddle.net/putgbymo/

First we add summaryRow in totalData

Code: [Select]
  totalData = { summaryRow: true, ConfirmedQuantity: revenueTotal};

Then we use it in render callback:

Code: [Select]
                    render: function (ui) {
                    if( !ui.rowData.summaryRow)
                                return "<button type='button' class='Attach_btn'>Attachments</button>";
                    },

virendraparade01

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: column calculation
« Reply #4 on: August 16, 2019, 08:58:37 pm »
  {
                title: "UNIT OF MEASURE", width: 100, dataType: "string", dataIndx: "UnitOfMeasure",
                render: function (ui) {
                    var abc = ui.rowData.ItemNo
                    var Unit = GetUnit(abc)                                                       //calling the GetUnit Function
                    return ui.cellData = Unit;
                }
               
             
            },

using the above solution I can see the value of ui.celldata on screen...but whenever I try to

  var gridChanges = grid.getChanges({ format: 'byVal' });
 console.log(gridChanges);

UnitOfMeasure: undefined

Here why can't I get the value of cell Unitofmeasure...could u plz help me out
« Last Edit: August 16, 2019, 09:32:48 pm by virendraparade01 »