I have a custom site column named "Item Number". now i want to force this column to be un-editable inside the Quick Edit grid. now when i try to edit the site column (Site Setting>> Site Column >>click on the column), the url will be as follow:-


which mean the field ID = ID1. so to be able to hide the column from all the Quick edit grid , i wrote the following JSLINK script (HideColumnsINGrid.js):-

(function () {
    var overrideContext = {};
    overrideContext.Templates = overrideContext.Templates || {};
    overrideContext.Templates.OnPreRender = function(ctx) {
        var statusField = ctx.ListSchema.Field.filter(function(f) {
            return f.ID === 'ID1';
        if (statusField) {
            statusField[0].AllowGridEditing = false;

then i wrote the following powershell script to apply the above JSlink to the field as follow:-

 $web = Get-SPWeb http://vstg01
    $field = $web.Fields["Item Number"]
    $field.JSLink = "Style%20Library/JS/HideColumnsINGrid.js"


now the power shell script did not raise any error , but the Item number can still be edited from the Qucik Edit ?so can anyone adivce on this please ?


  • 1
    If your js file is being loaded in New/Edit form? Jun 9, 2015 at 8:43
  • @KalpeshVaghela now i added "alert(12345);" inside the script but it did not get fire,, also the page source does not have any referecne to the script... but if i am not wrong the script is not supposed to load inside the new/edit forms it should fire if i am inside the quick edit grid ,, is this correct?
    – John John
    Jun 9, 2015 at 10:04

1 Answer 1


Here is your answer

(function () {

var fieldContext = {
    Templates: {
        Fields: {
            ID1: {
                View: function (ctx, b) {
                    b.AllowGridEditing = false;
                    return ctx.CurrentItem.ID1;

You need to apply that JSLink to view not in field.

  • so you mean i need to add this to the all the list's views, and also to any additional views ? this will not be a good approach as i have many views and i do not want to be editing them separately ,, i want to define this based on the item not based on the view,,and have the effect automatically inside all the views... what do u think ?
    – John John
    Jun 9, 2015 at 11:03
  • can you adivce on my comment please?
    – John John
    Jun 9, 2015 at 21:39

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.