Code-mode custom JS and CSS libraries

Vefa Gulecyuz shared this question 5 months ago
Answered

Hi guys, I am trying to use datatables in YF 9 code-mode.

I need to link the related js and css libraries but I could not figure out where to place them. Any suggestions?

Please see the attached ss

Comments (5)

photo
1

Hi Vefa,

Thanks for reaching out. If you take a look at our Code Mode Example in our Wiki entry for Dashboard Code Mode, you'll see that External Libraries should be referenced in the JavaScript section. You may need to alter the syntax a bit from our example to include this library, but I'm afraid the exact methods by which these scripts would have to be altered would be best handled by a developer, which is who Code Mode is intended for, but please let me know if this example proves to be helpful.

That said, there is one thing that jumps out at me here that may be worth starting from - this portion:

$(document).ready( function () {
    $('#exampe').DataTable();
} );

Should be removed from the HTML section and placed in the JS section.

Regards,

Mike

photo
1

Hi Mike, thanks for the explanation.

Usually, we put the javascript libraries in the head part of an HTML document. Is there a possibility to reach out that section?

If not, I have to use the intended method, as you said.

Thanks for the function warning as well!

photo
1

Hi Vefa,

I think you're okay to leave the libraries in the HTML section. This whole part:

/62ac29aeb7b6f740eb8c17062e8c76fa

But the function to call the libraries that I referenced in my previous post should be in the JS section.

Regards,

Mike

photo
1

Hi Vefa,

I just wanted to check in and see how things are going with this.

Regards,

Mike

photo
1

Hi Mike, thanks. I was able to solve my problem. You can close the ticket.