Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 13th, 2012  |  syntax: None  |  size: 1.02 KB  |  hits: 18  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. jqgrid saverow related help needed
  2. var lastsel;
  3.  
  4. grid.jqGrid({
  5. url:'grid_data_loader.php,
  6. datatype: 'json',
  7. mtype: 'POST',
  8. colNames:['ID','Date Created','Subject','Status','Location','Action'],
  9. colModel :[
  10.   {name:'id', index:'id', align:'center', hidden:true},
  11.   {name:'date'},
  12.   {name:'subject'},
  13.   {name:'status',align:'center'},
  14.   {name:'location',editable: true, align:'center', edittype:"select",
  15.  
  16. editoptions: {
  17.                dataUrl: 'control.php',
  18.                dataEvents: [
  19.                   {  type: 'change',
  20.                      fn: function(e) {
  21.                         grid.saveRow(lastsel,true);
  22.  
  23.                      }
  24.                   }
  25.                ]
  26. }    
  27.  
  28.  
  29.   },
  30.   {name:'action'}
  31. ],
  32. rowNum:10,
  33. rowList:[10,20,30],
  34. autowidth: true,
  35. height: "100%",
  36. pager: '#pager',
  37. sortname: 'id',
  38. viewrecords: true,
  39. rownumbers: true,
  40. sortorder: "asc",
  41. editurl: "control.php?case=8",
  42. onSelectRow: function(id){
  43.   if(id && id!==lastsel){
  44.     grid.jqGrid('restoreRow',lastsel);
  45.     grid.editRow(id,true);
  46.     lastsel=id;
  47.   }
  48. }
  49.  
  50. });