Am doing some coding on JSlink to implement conditional formatting on SharePoint lists. We are using SharePoint 2013 online (office 365). The format of the given field(s) are changed based on other fields. The conditional formatting is working perfectly, when all the fields are shown on a list view. To make the list view pretty, I need to create new list view with fewer column, also I want to give the flexibility for the users to have other views if they wish.
The Problem:
Once I remove a fields from the list view, the value turned into ‘undefined’ which break all the fields formatting because they are related. (Make sense because am using client side rendering to do the conditional formatting).
The Question:
What is the best way to read/retrieve value of fields that are not part of the view using JavaScript?
The Code:
Am using the following code to retrieve data of fields.
var planD = ctx.CurrentItem.InternalName1;
var actualD = ctx.CurrentItem.InternalName2; // Once I remove this field from the list view it returns undefined
Looking forward to get help
Thanks
Thanks Pradip,
Yes I do believe that I cannot get the value on non-view field.
Do you have any code to share with me?
Can I send you the Js file on private?
Well, as per my understanding you will not get any of the non-view fields in the JSLink context. So I think you should get the particular fields using SP.js or SPServices jQuery library by item id in your JSLink file.