Disable editing in kendo grid

后端 未结 5 858
臣服心动
臣服心动 2021-01-19 07:26

I am trying make the an editable grid to uneditable depend on conditions.

I have tried in jquery as below

var $grid = &(\"#gridName\").data(\"ken         


        
5条回答
  •  醉话见心
    2021-01-19 08:08

    to disable cell editing:

     var len = $("#gridName").find("tbody tr").length;
        for(var i=0;i<=len ; i++)
        {
            var model = $("#gridName").data("kendoGrid").dataSource.at(i);
            if (model) {//field names
                model.fields["DueDateStr"].editable = false;
                model.fields["TotalAmount"].editable = false;
                model.fields["IsPercentage"].editable = false;
            }
    
        }
    

    to disabled check box control's which it in the template:

    $.map($("#gridName").find("input:checkbox"),
            function (item) {
                $(item).attr('disabled', 'disabled');
            }
        );
    

    to remove command buttons like delete button:

     var rows = $('#gridName tbody tr');
        $.map(rows, function (row) {
            //cell buttons index
            row.cells[4].innerHTML = "";
    
        });
    

    to hide toolbar grid:

    $("#gridName .k-grid-toolbar").hide();
    

提交回复
热议问题