Add Custom JS to a List View

Hi All…

I’m trying to simply ā€œhideā€ an element on the list view page in the list of results.
(It’s an SMS icon that a plugin adds to all phone numbers…and I’m now hiding on non-mobile phone numbers)

I have this working fine with jQuery on the Detail view pages, by using the ā€œincludesā€ array in the detailviewdefs.php file to point to my JS file…but I’m not seeing this ā€˜includes’ array in the LISTviewdefs.php file.

Is there some way to extend this file like you can with detailviewdefs???

Thanks all!!

You can use custom/modules/[YourModule]/views/view.list.php for adding JS to list view. Use preDisplay or display function to echo out the Script.

Hey! Thanks for the feedback…but, I might be missing something…

I’m really trying to modify the layout of some standard module lists (specifically, Leads, Accounts, Contacts).

I’m not seeing a ā€˜views’ folder in the directories for Lead, Accounts, Contacts…nor in the custom module folders for the new ā€˜module’ for SMS messages.
(/custom/modules/Leads … no ā€˜views’ folder)

I DO see a ā€˜views’ folder in the
/modules/Leads/views
folder…but seems like making changes there wouldn’t be update-proof???

Is there perhaps some way that these folders/files are generated by the system??

Thoughts??

You can manually create folders in CUSTOM folder and use Repair from the Administration Page.

The above is correct. Here is a more complete write-up on this subject:

Ahhh…I understand!
Thanks!
I’ve got that file loading now…it’s breaking the list page…but I’m sure I’ve just got some syntax wrong…
But I understand how to get that file to extend the listview now!
Thanks!

Cool! Thanks!
I understand the concept now…now need to get my code working.
Thanks!

1 Like

Guys! This was SUPER helpful!
I have all the lists modified!

BTW: Is there a way to extend the Dashboard similarly???

Never Mind…I answered my own question.
It IS, in fact, possible to extend the Dashboard by adding custom php to
custom/modules/Home/views/view.list.php

Thanks all!!!

Hi
Can this be done in Suitecrm 8.x?

It depends on the specific customizations you’re doing.

  • Some of them will just work in v8

  • Some won’t and will require completely different ways to implement

  • Some will still work in v8 but only if you switch your module to legacy mode