Skip to main content

I’m not at versed in Javascript but can usually hack my way around…however, I’m having an issue with a HighlightRow snipped based on an opportunity expiration date.  

I’ve successfully created a row highlight snipped based on a specific value in the past (using  (field.mode == ‘readonly’ && value === “P”)  but I don’t know how to write an argument that would change use a date.  

Here is my HighlightRow snippet that changes a row color when a cell value contains “P”:


var field = argumentss0], value = skuid.utils.decodeHTML(argumentsu1]); skuid.ui.fieldRenderers)field.metadata.displaytype]ifield.mode](field,value); if (field.mode == 'readonly' && value === "P") { field.item.element.addClass("LeadTab_highlighted-row"); } 

<br>

How can I write a snippet that applies a Class when a date in a cell is less than today’s date?

Thanks!

Gary

You should be able to use something like this:


var field = arguments[0], <br />value = skuid&#46;utils&#46;decodeHTML(arguments[1])<b>,<br /></b><b>jsDateValue = skuid&#46;time&#46;parseSFDate(value)</b>; skuid&#46;ui&#46;fieldRenderers[field&#46;metadata&#46;displaytype][field&#46;mode](field,value); <br />&nbsp;if (field&#46;mode == 'readonly' &amp;&amp; <b>(jsDateValue &lt; new Date() ))</b> { field&#46;item&#46;element&#46;addClass("LeadTab_highlighted-row");<br />&nbsp;}

Thanks for taking a look at this!  

I’m getting this error:


Uncaught TypeError: skuid.utils.parseSFDate is not a function



Sorry about that. I edited the comment right after I posted it. It should be skuid.time…
It’s corrected above.


Ok, no error…it is applying the class but now it’s not changing the color of the row.  

Here is my CSS:


tbody.nx-skootable-data tbody tr.LeadTab_highlighted-row &nbsp;{ &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<br>&nbsp; &nbsp;background-color: #F05423;<br>}


Here is Matt’s snippet:


var field = argumentsg0],&nbsp;value = skuid.utils.decodeHTML(argumentsg1]),<br>jsDateValue = &nbsp;skuid.time.parseSFDate(value);<br>skuid.ui.fieldRenderersnfield.metadata.displaytype]afield.mode](field,value);&nbsp;<br>&nbsp;if (field.mode == 'read' &amp;&amp; (jsDateValue &lt; new Date() ))&nbsp;<br>&nbsp; &nbsp; {&nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; field.item.element.addClass("LeadTab_highlighted-row");<br>&nbsp;} 


Again, I’m successfully using this on other pages with that CSS…so I don’t think the issue is with the CSS.  


Try this instead for the css:

table.nx-skootable-data tbody tr.LeadTab_highlighted-row td {    
   background-color: #F05423;
}