{ field : 'isRead', title : '标记已读', width : 100, formatter : function(value, row, index) { if (row.isRead == "0") { return "<a name='flagRead' href='javascript:void(0)' onclick=\"flagRead("+row.mid+","+index+");\">标记为已读</a>"; /* onclick=\"mysort("+index+",'3');\" */ }else{ return "已读"; } } },
function flagRead(mid,row){ console.log(mid+row) $.post("../MessageAction_falgRead", { mid:mid}); $('#grid').datagrid('updateRow',{ index: 2, row: { isRead: '已读' } }); }
在datagrid中添加方法
onLoadSuccess:function(data){ $("a[name='flagRead']").linkbutton({text:'标记为已读',iconCls:'icon-ok'}); $("a[name='reply']").linkbutton({text:'回复消息',iconCls:'icon-undo'}); },