I'm trying to use client side rendering to fix the width of the columns for my sharepoint (2013) list.
I've picked up the code from https://kogzee.wordpress.com/2013/10/21/sharepoint-2013-using-client-side-rendering-jslink-to-change-column-widths-in-lists/
But it does not work.
So my code is
(function () {
// Initialize the variable that stores the objects.
var overrideCtx = {};
overrideCtx.Templates = {};
overrideCtx.OnPostRender = postRenderHandler;
// Register the template overrides.
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideCtx);
})();
// The postRenderHandler attends the OnPostRender event
function postRenderHandler(ctx) {
$("div[name='Comments1']").css("width","80px");
$("div[name='Comments2']").css("width","80px");
}
The console debugger comes up with the error
SCRIPT1006: Expected ')'
Within the debugger, the code looks like -
$(�div[name=�Comments1�]�).css(�width�, �80px�);
$(�div[name=�Comments2�]�).css(�width�, �80px�);
this doesn't seem quite right! I've tried replacing the single quotes with double quotes and the other way around.
Suggestions on what I might have done wrong?
Thanks
'
and see if those are better encodeddiv
s you must have something wrong in your selectors, or do not have jQuery defined