2016-06-29 24 views
0

剣道編集可能グリッドの最初のセルからの編集を無効にしたいと思います。実際には、剣道グリッドの最初のセルから日付ピッカー を削除しようとしていますが、そこにいる必要はありません。私は以下を使用しているので、このコードはグリッドからdatepickerを削除しますが、それでもテキストボックスは表示されます。 私はそれを完全に取り除くことができるはずです。剣道編集可能グリッドから動的に編集する方法

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> 
+0

編集イベントでは、それは 'グリッドを使用されていない場合は、単に全体の列を非表示にすることができます。 –

+0

http://stackoverflow.com/questions/20881484/make-cell-readonly-in-kendo-grid-if-condition-is-met – calinaadi

答えて

0

dataSourceのモデルで特定の列の編集を無効にすることができます。たとえば、次のように

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

ソース:Telerik Forums

編集:動的にそれを行うには

var model = $("#EditableGrid").data("kendoGrid").dataSource.getByUid(currentUid); 
if (model) { 
    model.fields["ProductID"].editable = false; 
} 
+0

これで列全体が無効になります。私はちょうど行の最初のセルで編集を無効にしたいだけで、他のセルでは編集しないでください。 – Sandy

+0

私の回答を編集しました – mrmashal

関連する問題