Jqgrid - 比较 jqgrid 中两列的值。其中一个是文本框,另一个是不可编辑的列。
Jqgrid - Compare value of two columns in jqgrid. One of them is a textbox and other is non editable column.
我的jqgrid中有一列有一个文本框控件。当在该文本框中连续输入值时,它应该与另一列(不可编辑)中的值进行比较,并在值不相等时显示错误。
来自 Here
中的 wiki
你可以看到我在JsFiddle
中创建的解决方案
要查看它是否正常工作,请尝试编辑姓氏单元格,如果它与行中的名字不匹配,它将抛出错误(不切实际,但仅用于说明目的)
使用 beforeSaveCell
afterSaveCell: function(rowid,name,val,iRow,iCol) {
alert("alert1!");
},
beforeSaveCell: function(rowid,name,val,iRow,iCol) {
// Just to get the current row b/se it is not available in custom_func
currentRow= rowid;
},
并将编辑规则添加到要编辑和验证的单元格中
{name:'lastname', index:'lastname', width:90, editable: true , "editrules":{"custom":true,"custom_func":validateText}},
我的jqgrid中有一列有一个文本框控件。当在该文本框中连续输入值时,它应该与另一列(不可编辑)中的值进行比较,并在值不相等时显示错误。
来自 Here
中的 wiki你可以看到我在JsFiddle
中创建的解决方案要查看它是否正常工作,请尝试编辑姓氏单元格,如果它与行中的名字不匹配,它将抛出错误(不切实际,但仅用于说明目的)
使用 beforeSaveCell
afterSaveCell: function(rowid,name,val,iRow,iCol) {
alert("alert1!");
},
beforeSaveCell: function(rowid,name,val,iRow,iCol) {
// Just to get the current row b/se it is not available in custom_func
currentRow= rowid;
},
并将编辑规则添加到要编辑和验证的单元格中
{name:'lastname', index:'lastname', width:90, editable: true , "editrules":{"custom":true,"custom_func":validateText}},