jqGrid dynamic select option - beforeEditCell not firing

Posted by mango on Stack Overflow See other posts from Stack Overflow or by mango
Published on 2010-04-05T16:50:57Z Indexed on 2010/04/05 16:53 UTC
Read the original article Hit count: 1510

Filed under:
|
|
|

I'm creating a jqgrid with one drop down column. I need the options of the drop down columns to change dynamically so I thought I can catch the beforeCellEdit event.

however it does not seem to be firing. any idea on what i am doing wrong? there is no error, and i did check that i have included the jqgrid edit js files.

var lastsel2;
jQuery(document).ready(function(){ 
    jQuery("#projectList").jqGrid({
        datatype: 'json',
        url:'projectDrv.jsp',
        mtype: 'GET',
        height: 250,
        colNames:['Node','Proposal #', 'Status', 'Vendor', 'Actions'],
        colModel :[ 
          {name:'node', index:'node', width:100, editable:false, sortable:false},
          {name:'proposal', index:'proposal', width:100, editable:false, resizable:true }, 
          {name:'status', index:'status', width:100, resizable:true, sortable:false, editable:false  },
          {name:'vendor', index:'vendor', width:100, resizable:true, editable:false, sortable: false },
          {name:'actions', index:'actions', width:100, resizable:true, sortable:false, editable: true, edittype:"select" }
        ],
        pager: '#pager',
        rowNum: 10,
        sortname: 'proposal',
        sortorder: 'desc',
        viewrecords: true,
        onSelectRow: function(id){ 
          if (id && id!==lastsel2){ 
            jQuery('#projectList').jqGrid('restoreRow',lastsel2); 
            jQuery('#projectList').jqGrid('editRow',id,true); 
            lastsel2 = id; 
          } 
        }, 
        beforeEditCell: function(rowid, cellname, value, irow, icol) { 
          alert("before edit here " + rowid);
          // set editoptions here
        }

});

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jqgrid