1.renderer="onActionRenderer"
如我们需要在一行数据时加上删除操作时,就需要在每行上加上“删除”按钮,以下为实现代码:
列加载时主要的属性
<div name="action" width="120" headerAlign="center" align="center" renderer="onActionRenderer" cellStyle="padding:0;">操作</div>
function onActionRenderer(e) { var grid = e.sender; var record = e.record; var uid = record._uid; var rowIndex = e.rowIndex; var id = record.id; var s = '<a class="reset" href="javascript:del_notice(\'' + id + '\')" >删除</a>'; return s; } function del_notice(id) { if (confirm('确定删除吗')) { $.ajax({ type:"get", url:"index.php?id=" + id , success:function(result){ grid.reload(); } }) } }