Get selected rowinfo in pivot grid

Hi

We have a requirement where we are not enabling selection in pivot grid, but need to get the row info (grandtotal of the column) from the pivot grid on demand from .ts file based on rowindex only.
How to achieve it ?


Thanks,
Dileep gagan R

3 Replies 1 reply marked as answer

SS Saranya Sivan Syncfusion Team December 24, 2020 01:29 PM UTC

Hi Dileep, 
  
Based on your requirement we have prepared a sample to get row info (grand total of the column) of the pivot table. Please check the below sample and code snippet for your reference. 
  
  
Code Snippet: 
  
document.getElementById("rowInfo").onclick = () => { 
      let pivotValues: any = this.pivotObj.pivotValues; 
      console.log(pivotValues[pivotValues.length - 1]); 
    }; 
  
We hope the above sample meets your requirements. Please let us know if you have concern. 
  
Regards, 
Saranya Sivan. 
 
 



DG Dileep gagan R replied to Saranya Sivan December 29, 2020 04:12 AM UTC

Hi Dileep, 
  
Based on your requirement we have prepared a sample to get row info (grand total of the column) of the pivot table. Please check the below sample and code snippet for your reference. 
  
  
Code Snippet: 
  
document.getElementById("rowInfo").onclick = () => { 
      let pivotValues: any = this.pivotObj.pivotValues; 
      console.log(pivotValues[pivotValues.length - 1]); 
    }; 
  
We hope the above sample meets your requirements. Please let us know if you have concern. 
  
Regards, 
Saranya Sivan. 
 
 


Hi,

Thanks for the response, we are looking for single row at a time, passing rowindex or colindex and getting the grandtotal of the row. 

In the example provided we will get grandtotal of all the rows. we require based on rowindex or colindex. How to achieve this?

Thanks,
Dileep gagan R


SS Saranya Sivan Syncfusion Team December 29, 2020 11:49 AM UTC

Hi Dileep, 
  
We have modified the sample to show the grand total based on the row index in the pivot table. Please find the sample for your reference.   
  
  
Code Snippet: 
  
displayGrandTotal(rowIndex) { 
    let pivotValues: any = this.pivotObj.pivotValues; 
    console.log(pivotValues[pivotValues.length - 1][rowIndex].value); 
  } 
  
Please let us know if you have concern. 
  
Regards, 
Saranya Sivan. 



Marked as answer
Loader.
Up arrow icon