Accessing RT's Jquery in custom JS file?

I’m hoping to do some customization with custom fields and Jquery. To do that, though, I need Jquery. I see that RT already has it in the share/static directory, and I know how to add my own .js files to RT. How, though, do I get at Jquery from my JS files? Is there a magic variable or path that will access first local/static and then share/static, like happens when RT loads html files? Or am I better off putting my own copy of Jquery in local/static and loading it the normal way? Is there anything else I need to know about Jquery in RT that might not be obvious?

Hi Alex,

I would use the RT provided jQuery the customising/styling documentation
contains useful information, javascript files can be loaded
in a simular manner as css files.

https://docs.bestpractical.com/rt/4.4.2/customizing/styling_rt.html#Additional-files
RT - RT 4.4.2 Documentation - Best Practical

*** Beware shameless plug *** This extension may help with the
customisation of customfields…

GitHub - wheldom01/rt-extension-csvcustomfields: Comma Seperated CustomFields Extension for Request Tracker issue tracking system

Best Regards

Martin

Hi Alex,

You just need to load the file containing jquery and in the file(s) wait
for the document to be ready…

i.e…

jQuery(document).ready(function() {

 jQuery.noConflict();

 .......
 .......

}

Best Regards

Martin

Thanks for the help. Unfortunately, I can’t get this to work. As I understand it, I should have my JS files across all RT’s pages. However, I’m not seeing either my code or an include for my local/static/js file in pages. I added it to that folder, and added

Set(@JSFiles, (‘test.js’));

to my configuration. That setting shows up correctly when I view the web-based config, so I know it’s right. Any idea why the .js file isn’t being included? I’ve restarted the FCGI server as well as cleared the mason cache. Thanks again.

Hi Alex,

Don’t know if you ever got to the bottom of this, but here goes anyway.
Just been looking into this and this works in the following manner:

RT takes the content of your specified javascript file and adds it to
the generated squished javascript.
In addition you don’t need the jQuery document ready just the specifier
and the action you want it to carry out.

This is why you only see the import of the squished javascript as shown
below.

Hope that helps

Martin