根据JQGRID中的条件编辑行 [英] Edit rows based on condition in JQGRID

查看:93
本文介绍了根据JQGRID中的条件编辑行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在JQGRID中使用FORM EDIT. 我用不同的颜色显示行; 红色:无法编辑行. 黑色:行可以编辑

Using FORM EDIT IN JQGRID. I am display the rows in different color; Red: Row cannot be edited. Black: Row can be edited

当用户单击编辑"按钮并且所选行为红色时;消息应显示,记录无法编辑.

When the user click edit button and if the selected row is in red color; Message should be displayed record cannot be edited.

如果用户选择了用黑色标记的可编辑行;用户可以编辑该行.但是,当用户使用onclickPgButtons函数通过单击(PgButtons)移至不可编辑的下一行时.它不应禁止他们以只读模式编辑显示.

If the user selected a editable row marked in black; User can edit the row. But when the user moves to next rows which non editable by clicking (PgButtons) using onclickPgButtons function. Its should not alow them to edit display in a readonly mode.

请告知

推荐答案

1.有一个名为beforeSubmit的选项.在这里您可以检查您的状况.
这是我在我的应用程序中使用的东西.

1. There is an option called beforeSubmit. Here you can check you condition.
Here is what i am using in my app.

beforeSubmit: function(postdata, formid){
  var allRowsInGrid = $('#DemoEvents').jqGrid('getRowData');
  var eventIdArray = new Array();
  for (var indexEventId = 0; indexEventId < allRowsInGrid.length; indexEventId++) {
    var  anchorId  = jQuery("#DemoEvents").getCell(indexEventId+1, 7);
    eventIdArray.push(anchorId );
  }
  var selectedEvent = jQuery("#DemoEvents").jqGrid('getGridParam','selrow');
  var eventId = jQuery("#DemoEvents").getCell(selectedEvent, 0);
  for ( var index = 0; index < eventIdArray.length; index++) {
    var anchoredId = eventIdArray[index];
    if(anchoredId === eventId) {
    return [false, "You cannot delete the Event!"];
    }
  }
  return [true, ""];
} 

我希望它将对您的问题有所帮助.

I hope it will helps for your question1.

这篇关于根据JQGRID中的条件编辑行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆