var tg = $('#tg');
tg.treegrid({...}); // create treegridvar panel = tg.treegrid('getPanel');var body1 = panel.find('div.datagrid-view1 div.datagrid-body-inner');var body2 = panel.find('div.datagrid-view2 div.datagrid-body');var body = body1.add(body2); // the body containerbody.unbind('click').bind('click',function(e){ var tr = $(e.target).closest('tr.datagrid-row'); var id = tr.attr('node-id'); if (!e.ctrlKey){ tg.treegrid('clearSelections').treegrid('selectRow',id); } else { if (tr.hasClass('datagrid-row-selected')){ tg.treegrid('unselectRow',id); } else { tg.treegrid('selectRow',id); } }});
var dg = $('#dg');
dg.datagrid({...});var dc = dg.data('datagrid').dc;var body = dc.body1.add(dc.body2);body.unbind('click').bind('click',function(e){ var tr = $(e.target).closest('tr.datagrid-row'); var index = parseInt(tr.attr('datagrid-row-index')); if (!e.ctrlKey){ dg.datagrid('clearSelections').datagrid('selectRow',index); } else { if (tr.hasClass('datagrid-row-selected')){ dg.datagrid('unselectRow',index); } else { dg.datagrid('selectRow',index); } }});