$('#test').datagrid({ onLoadSuccess: function(){ function bindRowsEvent(){ var panel = $('#test').datagrid('getPanel'); var rows = panel.find('tr[datagrid-row-index]');
rows.unbind('click').bind('click',function(e){//解除每行easyui自动绑定的onclick事件 return false; });
rows.find('div.datagrid-cell-check input[type=checkbox]').unbind().bind('click', function(e){//为每行的checkbox绑定onclick事件 var index = $(this).parent().parent().parent().attr('datagrid-row-index'); if ($(this).attr('checked')){ $('#test').datagrid('selectRow', index); } else { $('#test').datagrid('unselectRow', index); } e.stopPropagation(); }); } setTimeout(function(){ bindRowsEvent(); }, 10); } });
点击行不自动选中checkbox --datagrid easyui
最新推荐文章于 2020-05-21 16:45:38 发布