Allow export of specific columns from Table Grid table Ferenc Nagy September 18, 2018 16:03 Follow Have more questions? Submit a request 8 Comments Date Votes 0 Simone Chen September 12, 2018 18:34 While the Table field in Jira may have all the necessary details / columns for given uses cases, oftentimes upon export users may only have the need for a subset of the columns (due to the final audience for consumption). Take for instance, in Jira, the team members may be working on the ticket and adding all necessary details to perform work in the table but when exporting out of the system for manager review, the manager may not need all the details in all columns. 0 Aron Gombas September 13, 2018 13:54 Simone, This is doable even if it may not be super-intuitive. The implementation of the Better PDF Exporter - Table Grid integration is based on: getting the field value from Table Grid as an HTML string pre-processing the HTML string converting the HTML string to FO and inserting the FO back to the template If, between step 2 and 3, you take the HTML string and remove the unwanted columns from the HTML markup, then you have solved the problem! Does this make sense? 0 Simone Chen September 13, 2018 18:38 Thank you Aron! Conceptually it makes sense I think, we'll give this a look and let you know if there are any questions. 0 Simone Chen September 13, 2018 19:14 Hi Aron, Do you have a sample or something similar to the approach you've mentioned? Unfortunately we're not certain we're interpreting the code the right way. Thank you. 0 Aron Gombas September 14, 2018 07:59 If you look at the code of the cfValue() macro in the top of the template you will find this snippet.I marked the point where to insert your post-processing code that removes the unwanted parts: #elseif($customFieldTypeKey == 'com.idalko.jira.plugins.igrid:tableGridCFType') #set($htmlMarkup = $moduleDescriptor.getColumnViewHtml($customField, $customFieldValue, $issue, $map.build(), $fieldLayoutItem)) ## remove all <div ...> tags #foreach($j in [1..10]) #set($s = $stringutils.indexOf($htmlMarkup, "<div")) #if($s != -1) #set($e = $stringutils.indexOf($htmlMarkup, ">", $s)) #if($e != -1) #set($e = $e + 1) #set($htmlMarkup = $stringutils.remove($htmlMarkup, $stringutils.substring($htmlMarkup, $s, $e))) #end #end #end ## remove all </div> tags #set($htmlMarkup = $stringutils.remove($htmlMarkup, "</div>")) #set ($htmlMarkup = $htmlMarkup.trim()) ## ## <--- at this pont the $htmlMarkup string contains the table, you can remove rows, cells, etc. by manipulating the string ## $pdfRenderer.htmlToFo($htmlMarkup) I can't give a working example, but with minimal HTML skills and using the $stringutils class (see: https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html), it should be piece of make to modify it.(As an alternative, you could even XML-parse the HTML into a DOM object, manipulate that, and then serialize that back to string again. But it seems an overkill to me.) 0 Simone Chen September 14, 2018 17:44 Thank you Aron. We do have some code in place but it looks like the plugin isn't recognizing the Idalko class. Please see below: #set($pluginAccessor = $componentAccessor.getPluginAccessor())#set($dataManagerClass = $pluginAccessor.getClassLoader().findClass("com.idalko.jira.plugins.igrid.api.data.TGEGridTableDataManager"))#set($tgeGridDataManager = $componentAccessor.getOSGiComponentInstanceOfType($dataManagerClass))#set($columnNames = ["Column 1", "Column 2]) The error that is returned is: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getOSGiComponentInstanceOfType' in class com.atlassian.jira.component.ComponentAccessor threw exception java.lang.IllegalStateException: Unable to resolve component Thank you 0 Aron Gombas September 17, 2018 09:38 Simone, please open a support ticket and attach your full code so that we can have a look. 0 Simone Chen September 18, 2018 16:03 Hi Aron, Thank you I've gone ahead and created Request #4717 Please sign in to leave a comment.