`

easyUI checkbox选中点击不自动选中

 
阅读更多
$('#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){
                    return false;
                });
                rows.find('div.datagrid-cell-check input[type=checkbox]').unbind().bind('click', function(e){
                    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);    
    }
});
 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics