We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Grid Export PDF functionality does not seem to work with rowtemplate

I have the following code. The "Download PDF" button works but it returns only one "ID" column(which is a width=0 column). How can I make it honor the grid rowtemplate?
i am also not able to provide a running row number for a column with the Grid rowtemplate using the queryCellinfo event.
Please help.
<script id="rowtemplate" type="text/x-template">
                            <div class="card">
                              <div class="card-body">
                                <div class="timeline timeline-one-side" data-timeline-content="axis" data-timeline-axis-style="dashed">
                                  <div class="timeline-block">
                                    <span class="timeline-step timeline-step-sm bg-primary border-primary text-white">1</span>
                                    <div class="timeline-content">
                                      <div class="d-block h1 text-sm mb-0">${Text}</div>
                                      <medium><i class="fas fa-clock mr-1"></i>${CreatedAt}</medium>
                                      <a rel='nofollow' href="#">
                                        <img class="img-fluid" src="${MediaURLHttps}">
                                      </a>
                                    </div>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </script>
                          <ejs-grid id="SocialMediaAccountDetails" dataSource="@Model.Tweets" height="auto" rowTemplate="#rowtemplate"
                                    allowPaging="true" allowPdfExport="true" toolbarClick="toolbarClick" 
                                    toolbar="@( new List<object>() {"PdfExport"})" queryCellInfo="queryCellInfo">
                            <e-grid-pageSettings pageCount="10" pageSize="5" />
                            <e-grid-columns>
                              <e-grid-column headerText=" " width="0" field="Id" textAlign="Left" />
                            </e-grid-columns>
                          </ejs-grid>

function toolbarClick(args)
{
var gridObj = document.getElementById("SocialMediaAccountDetails").ej2_instances[0];
if (args.item.id === 'SocialMediaAccountDetails_pdfexport')
{
var exportProperties = {fileName: "tweets.pdf"};
gridObj.pdfExport(exportProperties);
}
}
var count = 1;
function queryCellInfo(args) {
if (args.column.headerText == "Row Number") {
args.cell.innerHTML = count;
count++;
}
}

  |
;

1 Reply

BS Balaji Sekar Syncfusion Team August 19, 2019 11:43 AM UTC

Hi Ajit, 
 
Thanks for contacting Syncfusion support.  
   
We have validated your query while checking your code example we have found that you have used rowTemplate in grid column. Currently, we do not have support for pdf export with rowTemplate, because template has any html element or custom components, so it does not support PDF, so it is not feasible to export the template into PDF file.  
   
Please get back to us if you need further assistance.  
 
Regards, 
Balaji Sekar. 


Loader.
Live Chat Icon For mobile
Up arrow icon