How can I use image in PivotView Row?

Hi

I want to use image in Pivot View row, How can it be?

For example Company logos

Best regards.

1 Reply 1 reply marked as answer

SS Saranya Sivan Syncfusion Team March 4, 2021 05:07 PM UTC

Hi Kenan Dogan, 
  
You can customize the row/ column headers using cell template option. Meanwhile, we have prepared a sample to add the image in the row. Please find the sample and UG in the below links. 
  
  
  
Code Example: 
 app.component.ts 
 getCellContent(e): void { 
    if ( 
      e.targetCell.classList.contains("e-rowsheader") && 
      !e.targetCell.classList.contains("e-gtot") && 
      !e.targetCell.querySelector(".e-image") 
    ) { 
      var imgElem = document.createElement("img"); 
      imgElem.classList.add("e-image"); 
      imgElem.setAttribute("src", "https://emoji.beeimg.com/😃/15"); 
      imgElem.setAttribute("style", " padding-right: 10px; float:right"); 
      e.targetCell.appendChild(imgElem); 
    } 
  } 
app.component.html 
  
  <ejs-pivotview   #pivotview 
    id="PivotView"  [dataSourceSettings]="dataSourceSettings" 
    width="100%"   height="1000"    [gridSettings]="gridSettings" > 
    <ng-template #cellTemplate let-data> 
      <span [innerHTML]="getCellContent(data)"></span> 
    </ng-template> 
  </ejs-pivotview>   
   
We hope that the above sample will meet your requirement. 
  
Regards,   
Saranya S. 
 
 


Marked as answer
Loader.
Up arrow icon