In this discussion I was encouraged to ask the community how to write a User Macro that allows user customization of the header titles for the Task Report Macro. Any help would be greatly appreciated!
How about something like this? I tried creating a user macro that you could embed a task report in the body, but the task report macro fails to load correctly if you put it inside a user macro. This is the compromise you just need to specify which task report macro on your page you are targeting.
Macro Name:
change_task_report_headers
Macro Title:
Change Task Report Headers
Macro Body Processing:
No macro body
Template:
## Developed by: Davin Studer ## Date created: 01/10/2019 ## @param Number:title=Task report macro number|type=string|required=true|desc=Which task report macro to apply to. ## @param Description:title=Rename Description|type=string|required=false|desc=Rename the "Description" column. ## @param DueDate:title=Rename Due date|type=string|required=false|desc=Rename the "Due date" column. ## @param Assignee:title=Rename Assignee|type=string|required=false|desc=Rename the "Assignee" column ## @param TaskAppears:title=Rename Task appears on|type=string|required=false|desc=Rename the "Task appears on" column. <script type="text/javascript"> //<![CDATA[ AJS.toInit(function(){ var which = $paramNumber; which = which - 1; #if ($paramDescription && $paramDescription != "") AJS.$('[data-macro-name="tasks-report-macro"] th.header-description').eq(which).text('$paramDescription'); #end #if ($paramDueDate && $paramDueDate != "") AJS.$('[data-macro-name="tasks-report-macro"] th.header-duedate').eq(which).text('$paramDueDate'); #end #if ($paramAssignee && $paramAssignee != "") AJS.$('[data-macro-name="tasks-report-macro"] th.header-assignee').eq(which).text('$paramAssignee'); #end #if ($paramTaskAppears && $paramTaskAppears != "") AJS.$('[data-macro-name="tasks-report-macro"] th.header-location').eq(which).text('$paramTaskAppears'); #end }); //]]> </script>
Hi Davin,
This is amazing, thank you! I had a question about providing the task report macro to which the customized headers should apply. I tried inputting the number 1 and sure enough it applied the custom headers, but is that the intended approach? If there was more than one Task Report on the page, would they be numbered by the order in which they appear on the page?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You are correct. If you put in 1 it will apply to the first. If you put in 2 it will apply to the second. Ideally I could just have the user macro have a body and put the task report macro inside and you would not need to specify which one to target as the user macro would target the task report macros inside it. However, the task report macro doesn't want to render correctly inside of a user macro.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.