0

I would like to disable edit from only first cell of kendo edit-able grid and I am doing something like below. Actually I am trying to remove a datepicker from first cell of kendo grid as it is not required to be there. so I am using below and this code removes datepicker from grid but it still shows a text box. I should be able to remove it completely.

  function onGridEditing(e) {
        var gridbody = $("#EditableGrid").data("kendoGrid");
        var gridData = gridbody.dataSource.view();
        var currentUid = gridData[0].uid;
        var Date = gridData[0].Date;
        var currenRow = gridbody.table.find("tr[data-uid='" + currentUid + "']");
        //var firstCell = currenRow.find('td:not(:empty):first');
        //firstCell.find('.k-select').remove();
        //alert(firstCell.val());
        currenRow.find('.k-select').remove();// this removes the datepicker but it is still showing textbox when user click on the row for edit.
        currenRow.find(".editDate").remove();

ALso I tried to apply a css over there so that it hide datepicker but not working
//$("#EditableGrid").data("kendoGrid")._data[0].addClass('hideMe');
    }

<style>

   .hideMe {
        /*visibility: hidden;*/
        border: none !important;
        background-color: none !important;
    }

</style>
Sandy
  • 275
  • 3
  • 8
  • 25

1 Answers1

1

You could disable editing of a particular column in the model of the dataSource. For example:

model: {
    fields: {
        ProductID: {
            //this field will not be editable (default value is true)
            editable: false
        }
    }
}

source: Telerik Forums

Edit: To do it dynamically:

var model = $("#EditableGrid").data("kendoGrid").dataSource.getByUid(currentUid);
if (model) {
    model.fields["ProductID"].editable = false;
}
mrmashal
  • 1,721
  • 18
  • 21
  • But this will disable whole column. I just want to disable edit on just first cell of a row and not in others. – Sandy Jun 29 '16 at 06:48