name: 'Aktiv', index: 'Aktiv', width: 100, edittype: 'checkbox', align: 'center',formatter: "checkbox", editable: true, formatoptions: {disabled : false}推荐答案您可以在loadComplete内设置click事件处理程序:You can set a click event handler inside of loadComplete:loadComplete: function () { var iCol = getColumnIndexByName ($(this), 'Aktiv'), rows = this.rows, i, c = rows.length; for (i = 1; i < c; i += 1) { $(rows[i].cells[iCol]).click(function (e) { var id = $(e.target).closest('tr')[0].id, isChecked = $(e.target).is(':checked'); alert('clicked on the checkbox in the row with id=' + id + '\nNow the checkbox is ' + (isChecked? 'checked': 'not checked')); }); }}其中var getColumnIndexByName = function(grid, columnName) { var cm = grid.jqGrid('getGridParam', 'colModel'), i, l; for (i = 1, l = cm.length; i < l; i += 1) { if (cm[i].name === columnName) { return i; // return the index } } return -1;};您应该使用 jQuery.ajax 来代替alert有关更新复选框状态的服务器.Instead of the alert you should use jQuery.ajax to send information to the server about updating the checkbox state.您可以在此处观看演示. 这篇关于JQgrid复选框onclick更新数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!