Another option is to include them in the view to get the data on the
ctx.CurrentItem object, but then use CSR to ultimately hide them.
Even if you use Danny Engelman's workaround, you will still need to include that column in the view.
You are correct in noting that in order to get the data, you will either need to include the columns in the view, or make another call to the list. Only columns included in the view will show up on the
How to pull it off? There might be several ways, CSS could be one of them, you might be able to find the
th header elements that correspond to those columns and add
display: none to them, and then override the fields and return an empty string (i.e. no HTML) instead of the regular value.
But, what I would try first is this:
ctx.ListSchema.Field (notice singular, not plural) is an array of
FieldSchema objects of the fields that are in the view. I know that you can add a fake column to the table by inserting a fake
FieldSchema object into that array in
OnPreRender. What I would try is, in
OnPreRender, loop through that array, find the
FieldSchema objects that correspond to the columns you want to hide, and splice them out of the array. Potentially you could trick SharePoint into not even thinking of rendering those fields, because they would no longer exist in the
Granted, I haven't tried that, so I don't know if it would really work, but that's what I'd start with.