如何动态地从剑道可编辑网格进行编辑

时间:2016-06-29 05:21:56

标签: jquery kendo-ui kendo-grid kendo-datepicker

我想仅从kendo可编辑网格的第一个单元格禁用编辑,我正在执行类似下面的操作。其实我正在尝试删除一个datepicker 来自剑道网格的第一个单元,因为它不需要在那里。所以我在下面使用此代码从网格中删除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>

1 个答案:

答案 0 :(得分:0)

您可以禁用dataSource模型中特定列的编辑。例如:

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

public class ConnectionDetector {
    private Context _context;

    public ConnectionDetector(Context context) {
        this._context = context;
    }

    public boolean isConnectingToInternet() {
        ConnectivityManager connectivity = (ConnectivityManager) _context.getSystemService(Context.CONNECTIVITY_SERVICE);
        if (connectivity != null) {
            NetworkInfo info = connectivity.getActiveNetworkInfo();

            if (info != null) {
                    if (info.getState() == NetworkInfo.State.CONNECTED) {
                        return true;
                    }
            }
        }
        return false;
    }
}

来源:Telerik Forums

编辑:动态执行:

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