Skip to main content
Nintex Community Menu Bar
Question

How to highlight a table row based on a date?

  • July 10, 2024
  • 5 replies
  • 7 views
  • Translate

Forum|alt.badge.img+7

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 = arguments[0], value = skuid.utils.decodeHTML(arguments[1]); skuid.ui.fieldRenderers[field.metadata.displaytype][field.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

Did this topic help you find an answer to your question?
This topic has been closed for comments

5 replies

Forum|alt.badge.img+18

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;}
Translate

Forum|alt.badge.img+7

Thanks for taking a look at this!  

I’m getting this error:

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

Translate

Forum|alt.badge.img+18

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

Translate

Forum|alt.badge.img+7

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 = arguments[0],&nbsp;value = skuid.utils.decodeHTML(arguments[1]),<br>jsDateValue = &nbsp;skuid.time.parseSFDate(value);<br>skuid.ui.fieldRenderers[field.metadata.displaytype][field.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.  

Translate

Forum|alt.badge.img+18

Try this instead for the css:

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

Translate

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings