0

I want to create what is basically a KPI column for a list that color codes each list item based on status. All of the examples I see to do that involve creating a new page, adding a web part to display the list, and then use some javascript via jslink to conditionally color each item.

The problem is that I want people to use the actual list, and not a web part on a web part page because when you add web parts that contains list data to a page, the user cannot create or see personal views like they can when they are working with the actual list or it's view page. And if they go to the actual list or list view page, they will not see the color coding.

So how can I provide both? Do I edit the actual page in SharePoint Designer that displays the list view (like allItems.aspx) instead of creating a new page and inserting a web part that displays the list? I don't know where to start and I don't know if it's possible to provide the user with both features of view creation and color coding on the same page or list.

6
  • 1
    How are you displaying Items without a WebPart?? "The actual list" is a ListView WebPart (in a Page) on which you can set the JSLink property, no need to create extra pages or add more webparts, or even open Designer. Commented Jan 4, 2017 at 16:18
  • The problem you will run into: On new View creation that JSLink might be empty by default, only way around that is to load your CSR files with a UserCustomAction (ScriptLink) and not with JSLink OR apply the JSLink not to the WebPart but to the View (which can't be done with the UI, only with code) Commented Jan 4, 2017 at 16:24
  • So could I just add some javascript to the AllItems.aspx page (for example) in SharePoint Designer, maybe at the bottom of the page?
    – user192632
    Commented Jan 4, 2017 at 17:30
  • Yes... but... its better to specifiy a JSLink on that ListView webPart already on the page.. because you probably want to reuse that script on other pages. No need for Designer; Go use Google and find the Chrome Cisar Extension, Cisar is the best thing since sliced bread. Commented Jan 4, 2017 at 17:38
  • ok, thanks. Put this together as an answer so I can mark it as such. Please specify how to add a jslink to the listview webpart for a comprehensive answer. Is it an attribute of the listview webpart? Sounds like it. Thanks.
    – user192632
    Commented Jan 4, 2017 at 17:46

1 Answer 1

1

CSR Customization 101

3
  • As a small clarifier, the jslink property is actually found within the view tag within the XsltlistView webpart, and is not a property of the web part itself
    – user192632
    Commented Jan 9, 2017 at 18:39
  • Yes, and that property is available in the Misc. section of the ListView Properties pane Commented Jan 9, 2017 at 20:17
  • Yes, but I was working in SPD in the actual code itself and within the view tag, I found a tag called <JSLink></JSLink>, so I kept getting confused when people were telling me to set the property in the properties pane because I could not get to that in the browser when working on a list, rather than a wiki or webpart page with a webpart in it.
    – user192632
    Commented Jan 11, 2017 at 16:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.