$(function() { $("#gridTable").jqGrid({ url: "file", postData:{}, datatype: "json", mtype: "GET", rownumbers: false, rowNum:<%=Integer.valueOf(PropReader.getText(StaticFinal.ROWNUM)) %>, auto false, closeAfterEdit: false, viewrecords: true, shrinkToFit: false, height: '100%', pager:"#gridPager", multiselect: false, scrollOffset: 0, caption: "FileList For DownLoad", colNames:['编号','文件名', '文件大小', '删除标记','备注', ''], colModel:[ {name:'file_id' ,index:'file_id' , 50 ,editable:false, sorttype:"string"}, {name:'file_name' ,index:'file_name' , 250}, {name:'file_size' ,index:'file_size' , 125 ,sorttype:"string"}, {name:'file_delete_flg',index:'file_delete_flg', 60}, {name:'file_beizhu' ,index:'file_beizhu' , 200}, {name:'downLoad' ,index:'downLoad' , 60 ,align:'center', sortable:false} ], jsonReader: { root:"gridModel", records: "record", rows: "rows", repeatitems : true }, gridComplete : function () { var ids = $("#gridTable").getDataIDs(); var beforeEditData = {}; for (var i = 0; i < ids.length; i++) { beforeEditData[ids] = $("#gridTable").getRowData(ids[i]); var syoriHtml = ""; syoriHtml = '<input style="height:22px;60px;" type="button" value="下载" onclick="downLoad(' + ids[i] + ')"/>'; $("#gridTable").setCell(ids[i], "downLoad", syoriHtml); } }, beforeRequest: function() {alert("beforeRequest");}, loadError: function() {alert("loadError");}, onSelectRow: function(rowID, status, e) {alert("onSelectRow");}, afterSaveCell : function (rowid, cellname, value, iRow, iCol) {alert("afterSaveCell");}, afterEditCell:function (rowid, cellname, value, iRow, iCol) {alert("afterEditCell:function");}, onSortCol: function (index, colindex, sortorder){alert("onSortCol");}, onPaging: function (index, colindex, sortorder) {alert("onPaging");}, beforeEditCell: function (id, name, val, iRow, iCol){alert("beforeEditCell");} }) });