本文主要是介绍jqgrid设置单元格可编辑,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1 在单元格的属性列设置为editable。
2 点击编辑按钮的时候,触发某一行设置为edit的状态。
jQuery("#rowed4").jqGrid({url:'server.php?q=2',datatype: "json",colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],colModel:[{name:'id',index:'id', width:55},{name:'invdate',index:'invdate', width:90, editable:true},{name:'name',index:'name', width:100,editable:true},{name:'amount',index:'amount', width:80, align:"right",editable:true},{name:'tax',index:'tax', width:80, align:"right",editable:true}, {name:'total',index:'total', width:80,align:"right",editable:true}, {name:'note',index:'note', width:150, sortable:false,editable:true} ],rowNum:10,rowList:[10,20,30],pager: '#prowed4',sortname: 'id',viewrecords: true,sortorder: "desc",editurl: "server.php",caption: "Full control"
});
jQuery("#ed4").click( function() {jQuery("#rowed4").jqGrid('editRow',"13");this.disabled = 'true';jQuery("#sved4").attr("disabled",false);
});
jQuery("#sved4").click( function() {jQuery("#rowed4").jqGrid('saveRow',"13", checksave);jQuery("#sved4").attr("disabled",true);jQuery("#ed4").attr("disabled",false);
});
function checksave(result) {if (result.responseText=="") {alert("Update is missing!"); return false;}return true;
}
这篇关于jqgrid设置单元格可编辑的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!