Skip to main content

Dear Forum Members, I'm a citizen developer that's running up against his limited understanding of CSR/Javascript. I'm trying to use CSR to enable row highlighting of items in a SharePoint on O365 list. Sources were primarily this post http://www.idubbs.com/blog/2014/js-link-highlighting-a-row-with-csr/ by Wes Preston, where he provides a sample script to achieve this. I'm just not able to get this working and call upon your expertise.

This is my simple list:

186450_pastedImage_2.png

...and this is my script:

186451_pastedImage_3.png

I want to trigger row highlighting for all items where Value1 == "1" (Value1 column is type Single line of text)

  • My script resides in the /Style Library/JSLink-Samples directory on the root site collection
  • The JSLink on the list web part (in Miscellaneous) is set to

~sitecollection/Style Library/JSLink-Samples/RowHighlighting.js

  • Script is attached below

Your wisdom is greatly appreciated.

Robert

you have two issues there:

- on lines 5 & 7 you have to use square brackets instead of curly ones

- on line 15 you have to call "length" instead of "Length" (ie. small letter instead of capital one)


Marian, thanks much for your response. I implemented the changes you identified, but unfortunately I still don't get the desired result: no highlights at all. On the same site, I have gotten other JSLink customization to work without issues, so I agree with you that it must be an error in this script somewhere. I also realize that this question has nothing to do with Nintex per se: it just came up during a Nintex workflow project. Thanks all the more for responding. Were you able to get this working yourself? And do you have any other suggestions? Kind regards, Robert.


yes, I have tested your script on my test list and it worked fine with suggested changes.

(I have set it to highlight for Valid = Yes)

just some thoughts

- have you checked developer console whether there are not reported any errors?

- have you tried to debug/step through your code whether it behaves as you expect?

- check whether you store and reference the script on the same path (search in developer console for script nama, it should appear among js includes; check the script path is correct)

- proof check you correctly reference your conditional column name, do not mix up column display and real name


Marian, thanks again for the time and effort. Meanwhile, I have solved the problem. The script errors you identified were certainly part of it, so thanks much for that. The other half was that the column Value1 that the script refers to turned out not to have Value1 as its internal name. When I created my test list, I went into Quick edit mode and quickly added columns by clicking on the + sign. When I inserted debug messages into the script, I found that the reference was 'undefined'. So, I deleted my columns and recreated them, this time using the official Create column option in the list setting. And boom, it started working.


Reply