Display image in row Pivot Table

hi

Can I display the name and picture of the personnel in the row?

I have no problem with displaying the name, but I want their picture to be displayed next to them

The photos are stored in the database and displayed in the HTML pages in this way

<img src="data:image/jpg;base64, @Convert.ToBase64String(item.Per_Pic_img)">


1 Reply

AP AngelinFaithSheeba PaulvannanRajadurai Syncfusion Team January 18, 2024 01:17 PM UTC

Hi Alireza,


Using “CellTemplate” option, you can able to customize the pivot table cells based on your requirement. However, we have prepared a sample by inserting the images in the first-row header based on your requirement. Please find it from the below attachment.


Code Example:

<div>

    <div>

        <ejs-pivotview id="pivotview" CellTemplate="${getCellContent(data)}">

       </ejs-pivotview>

    </div>

</div>

<script>

    window.getCellContent = function (e) {

        var template;

        if (e && e.cellInfo && e.cellInfo.axis =="row" && e.cellInfo.actualText == "France") {

            template = '<img class="custom_img" src=https://picsum.photos/40/40/>';

        } else {

            template = '';

        }

        return template;

    };

</script>


Output screenshot:


Also, please refer the below document to know more about the “CellTemplate” option.


Document: https://ej2.syncfusion.com/aspnetcore/documentation/pivot-table/row-and-column#cell-template


Regards,

Angelin Faith Sheeba


Attachment: WebApplication2_d0907357.zip

Loader.
Up arrow icon