jqGrid afterSaveCell事件未触发

时间:2013-05-04 01:23:44

标签: jqgrid

我正在尝试确定为什么在将光标放在可编辑单元格内时按Enter键时我没有收到警报。我在进入单元格进行编辑后获得第一个"alert1!"但是在按下回车键后我没有收到afterSaveCell:内的警报。

<!DOCTYPE html>
<html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>My First Grid</title>

    <style type="text/css">
    html, body {
        margin: 0;
        padding: 0;
        font-size: 75%;
    }
    </style>

    <link rel="stylesheet" type="text/css" media="screen" href="jqueryui/themes/redmond/jquery-ui.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="jqueryui/themes/redmond/jquery.ui.theme.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="jqgrid/css/ui.jqgrid.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="timepicker/jquery-ui-timepicker-addon.css" />
    <link rel='stylesheet' type='text/css' href='fullcalendar/fullcalendar/fullcalendar.css' />
    <link rel='stylesheet' type='text/css' href='fullcalendar/fullcalendar/fullcalendar.print.css' media='print' />

    <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
    <script src="http://code.jquery.com/jquery-migrate-1.1.1.min.js"></script>
    <script src="jqueryui/js/jquery-ui-1.10.1.custom.min.js"></script>
    <script src="jqgrid/js/i18n/grid.locale-en.js" type="text/javascript"></script>
    <script src="jqgrid/js/jquery.jqGrid.min.js" type="text/javascript"></script>
    <script type='text/javascript' src='fullcalendar/fullcalendar/fullcalendar.min.js'></script>
    <script type='text/javascript' src='timepicker/jquery-ui-sliderAccess.js'></script>
    <script type='text/javascript' src='timepicker/jquery-ui-timepicker-addon.js'></script>

    <script type="text/javascript">
    $(function(){ 
      $("#list").jqGrid({
        url:'php.scripts/customers.get.php',
        datatype: 'xml',
        mtype: 'POST',
        colNames:['idcustomers','firstname', 'lastname','address1','address2','city','state','zip','phone','email','cell'],
        colModel :[ 
        {name:'idcustomers', index:'idcustomers', width:55}, 
        {name:'firstname', index:'firstname', width:90, editable: true}, 
        {name:'lastname', index:'lastname', width:90, editable: true}, 
        {name:'address1', index:'address1', width:90, editable: true}, 
        {name:'address2', index:'address2', width:90, editable: true}, 
        {name:'city', index:'city', width:90, editable: true}, 
        {name:'state', index:'state', width:90, editable: true}, 
        {name:'zip', index:'zip', width:90, editable: true}, 
        {name:'phone', index:'phone', width:90, editable: true}, 
        {name:'email', index:'email', width:90, editable: true}, 
        {name:'cell', index:'cell', width:90, editable: true}
        ],
        pager: '#pager',
        rowNum:10,
        rowList:[10,20,30],
        sortname: 'idcustomers',
        sortorder: 'asc',
        viewrecords: true,
        gridview: true,
        caption: 'Customers',
        cellEdit: true,
        cellsubmit: 'clientArray',
        afterSaveCell: function(rowid,name,val,iRow,iCol) {
            alert("alert1!");
        },
        afterEditCell: function (id,name,val,iRow,iCol){
            alert("alert2!");
        }
      }); 
    }); 
    </script>

    </head>
    <body>
    <table id="list"><tr><td/></tr></table> 
    <div id="pager"></div> 
    </body>
</html>

1 个答案:

答案 0 :(得分:0)

如何在the demo上看到,它实际上使用了您的代码,将显示两个警报。你没有写过你使用的jqGrid版本。旧版本可能存在一些问题,但最后一个问题不存在。