1

我试图确定为什么当我将光标置于可编辑单元格内时按下回车键时我没有收到警报。我在输入单元格进行编辑时得到了第一个,但在按下回车键后"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>
4

1 回答 1

0

您如何在实际使用您的代码的演示中看到,这两个警报都将显示。您没有编写您使用的 jqGrid 版本。旧版本中可能存在一些问题,但最后一个版本中没有。

于 2013-05-04T13:28:19.437 回答