Greetings.
I've been enjoying developing my SaaS through Vue3, and was wondering if the support team could help me out with this issue - also a moment to thank the stellar ecosystem Syncfusion really is. I exhausted the documentation, but was unable to look into why printing template components didn't go too well.
Actual Issue Starts Here:
Here's the code snippet to the grid:
The test template is a very mundane one as follows:
The issue is, it displays perfectly in the grid itself. As follows:
However, during print, the following happens:
What I am unable to do, but wish to, is to get a prop/computed value passed to the print function, so it prints the actual content/string rendered by the template, than the component name.
How should I go about achieving so? Is there any sort of Accessor(I tried using the dataAccessor without avail), or something similar so print output is formatted correctly?
Hi Nobel Dahal,
Greetings from Syncfusion Support.
We validated the query. Based on your query, we understood that you are trying to print the v-slot template column. You can achieve the v-slot template column printing by using the grid's beforePrint event args customization. Based on your query, we have prepared a simple Vue3 slot column template printing sample with the customization. You can refer to that sample to achieve the same at your application level.
[code example]
|
<template> <ejs-grid ref='grid' id='grid' :beforePrint="beforePrint"> . . . . . . . . . . . . . . . . </ejs-grid> </template> <script> export default { methods: { beforePrint: function (args) { if (args.requestType == "print") { var elemArr = args.element.querySelectorAll('table tbody')[1].querySelectorAll('tr'); var gridRows = this.$refs.grid.getRows(); for (var i = 0; i < elemArr.length; i++) { elemArr[i].innerHTML = ''; elemArr[i].innerHTML = gridRows[i].innerHTML; } } } }, } |
Sample Link: forums/186215-print-column-template - StackBlitz
Please get back to us if you need further assistance with this.
Regards,
Vasanthakumar K