2

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.

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

Ramanan
  • 21
  • 2
  • Is your question how to implement this? Please give it a try, and then post code if you have specific questions. – Justin Ethier Mar 29 '10 at 16:00
  • Thanks ! Need help to the following questions. 1.How can we display message In Popup window "Record cannot be deleted" in the format we see "Select a row" instead of alert box. 2. Simallarly, I am able to catch the record navigation- event button . Problem I find here is unable make records readonly mode when the records are not ready to edit. 3. Other solution I found; to disable the control when the record is not editable. I need a message to be displayed to show the record cannot be edited either inline message / popup instead of alert button. – Ramanan Mar 30 '10 at 01:48

1 Answers1

0

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.

vissu
  • 1,921
  • 7
  • 37
  • 52