if can help, please follow this really clear documentation
you have to add to the first row of the dashboard the indication of the js e.g.:
<form script="table_icons_rangemap.js" stylesheet="table_decorations.css">
you can find documentation at
Then see the Splunk Dashboard Examples App (https://splunkbase.splunk.com/app/1603/) where you can find many examples of JS using.