jQuery MiniUI

标题: 不可编辑且为空 [打印本页]

作者: 小葱儿    时间: 2013-10-24 15:26:51     标题: 不可编辑且为空

本帖最后由 小葱儿 于 2013-10-24 15:34 编辑

在datagrid 中 对于如图[attach]3071[/attach]

在combobox改变为不固定时,我想要其后面的值 1 跟着其改变变为空,且不可编辑,并且在combobox改变的时候,能给出提示吗


我用的    function OnCellBeginEdit(e) {
        var record = e.record, field = e.field;
        if (field == "rank" && record.ranka =="0") {
            e.cancel = true;
            e.value = "";
            e.row.rank = "";

             //如果不固定,则不允许编辑固定值
        }
    }

   function ondrawcell(e) {
        if (e.field == "ranka") {
            if (e.value == 1) {
                e.cellHtml = "固定";
            }

            if (e.value == 0) {
                e.cellHtml = "不固定";
            }


        }
        if (e.field == "rank") {
            if (e.row.ranka == 0) {
                e.cellHtml = "";
            }


        }

    }
实现了不能点击和为空,但是在combobox 改变的时候不能给出提示

作者: felt    时间: 2013-10-24 16:06:25

你监听下combobox编辑器的onvaluechanged事件吧。
if(e.value=="0"){
     alert("不固定,不允许编辑固定值")
}
作者: factory    时间: 2013-10-24 16:08:58

监听endeidt事件

如果是combobox这列,并且e.value= 不固定,grid.updateRow(row,{field:"0"})

监听oncellbeginedit事件

如果e.row.field == 不固定,e.cancel = true




欢迎光临 jQuery MiniUI (http://miniui.com/discuss/) Powered by Discuz! X2