开发者

Edit rows based on condition in JQGRID

开发者 https://www.devze.com 2022-12-25 03:20 出处:网络
Using FORM EDIT IN JQGRID. I am display the rows in different color; Red: Row cannot be edited. Black: Row can be edited

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

1 Option

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

开发者_JAVA技巧

2 Option:

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.

Please advise


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消