Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Write script on list view

xiaix
Tera Guru

Trying to write a Client Script (onLoad) for a table list view is not working.   How can this be done?

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

Hi David,



onLoad client scripts only run when the form is loaded, not in a list. The only type of client script that applies to a list is onCellEdit.



http://wiki.servicenow.com/index.php?title=Client_Scripts


View solution in original post

13 REPLIES 13

Chuck Tomasi
Tera Patron

Hi David,



onLoad client scripts only run when the form is loaded, not in a list. The only type of client script that applies to a list is onCellEdit.



http://wiki.servicenow.com/index.php?title=Client_Scripts


Thanks, Chuck.   I figured as much.   I could write a global UI Script to check what conditions I'm looking for and then run the script, but that's a lot of overhead for every single click.


What is the requirement driving this question? Perhaps there are better alternatives.


Sure.


When looking at time cards ("All Time Cards") link, I want to right align these column headers:



find_real_file.png



I was going to write an on page load script that searched for "glide_field="time_card.total"" and then manipulate the DOM to add the style, text-align:right