2

I'm using a JSLink file to replace a "Single line of text" column with a custom checkbox. For some reason, when "Allow individual item checkboxes" is enabled my checkbox won't work - I can't even check it. When I turn off tabular view, my custom checkbox works normally.

Is anyone aware of a conflict between the OOTB tabular view checkmark (which appears to be just a DIV with an image inside it) and a post-added checkbox?

Here's my JSLink:

    (function () {
    var overrideCtx = {};
    overrideCtx.Templates = {
    overrideCtx.Templates.Fields = {
        'Actions': { 'View': renderActionIcons }
    };
    SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideCtx);
}) ();

function renderActionIcons(ctx) {
    var itemid = ctx.CurrentItem["ID"];
    var itemurl = ctx.CurrentItem["FileRef"];
    var itemcat = ctx.CurrentItem["Category"];
    var html = "";

    //Insert Checkbox
     if(itemcat.indexOf('Engineering') !== -1){
    html += "<input type='checkbox' id='" + itemid + "_Checkbox' align='absmiddle' class='documentcheckbox'></input>";
    html += "<label style='display:none'>/2" + itemurl + "</label>";
    }
     else {
    html += "<input type='checkbox' id='" + itemid + "_Checkbox' align='absmiddle' class='documentcheckbox'></input>";
    html += "<label style='display:none'>" + itemurl + "</label>";
    }

    //Write HTML code to page
    return html;
}

My checkbox renders either way, but with tabular view turned on I can't check the custom checkbox - it just blinks when I try.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.