<commit_before>(function($){     
    
    var methods = {  
        
        init : function( options ) { 
                    //Defino unas opciones por defecto
                    var opt = {                        
                        form_search     : true,
                        form_action     : '',
                        form_col        : 'data-search',
                        form_attr       : 'class="dw-form js-remote form-search"',
                        order_attr      : 'class="dw-ajax data-order dw-spinner"',
                        col_collapse    : 'col-collapse',
                        order_action    : '',
                        contenedor      : 'dw-shell-content'
                    }            
                    
                    $.extend(opt, options); //Extiende las opciones recibidas con las default
                    
                    return this.each(function(k) {  
                        
                        var table = $(this); //Tomamos el objeto tansformado en jquery                                                                                        
                        
                        thead = table.find("thead");
                        tbody = table.find("tbody");
                        hdrCols = thead.find("th");
                        bodyRows = tbody.find("tr");                                                
                        
                        if(table.parent().hasClass('dw-overflow')) {                             
                            container = table.parent().prev().hasClass('btn-toolbar') ? table.parent().prev() : $('<div class="btn-toolbar btn-toolbar-top"></div>');
                        } else {
                            container = table.prev().hasClass('btn-toolbar') ? table.prev() : $('<div class="btn-toolbar btn-toolbar-top"></div>');
                        }                                                
                        
                        containerCol = $('<div class="pull-right"><div class="btn-group"><button class="btn btn-only dropdown-toggle" data-toggle="dropdown"><span class="hidden-tablet hidden-phone"> COLUMNAS <i class="caret"></i></span><span class="hidden-desktop"><i class="icon-th"></i></span></button><ul class="dropdown-menu pull-right" /></div></div>');
                        
                        var th_responsive = [];
                        
                        hdrCols.each(function(i) {  
                            
                            var th = $(this), classes = th.attr("class");
                            //Se asigna un id a la colomna definida en el thead                            
                            var id = "col-"+k+"-"+ i;
                            th.attr("id", id);   
                                                        
                            if(!th.hasClass('no-responsive')) {
                                th_responsive.push('td:nth-of-type('+(i+1)+'):before { content: "'+th.text()+': "; }');
                            }
                                                        
                            // Hay que revisar los colspan
                            bodyRows.each(function(){
                                var cell = $(this).find("th, td").eq(i);                        
                                cell.attr("headers", id);                                
                                if (classes) { cell.addClass(classes); };
                                
                                if(opt.order_action!='') {
                                    if(th.attr('data-search')!=undefined) {                                    
                                        text = th.text();
                                        order = th.attr('data-search');
                                        asc = opt.order_action+'order.'+order+'.asc/';
                                        desc = opt.order_action+'order.'+order+'.desc/';
                                        cell.append('<div class="btn-group hidden-desktop"><a class="" data-toggle="dropdown" href="#"><span class="caret"></span></a><ul class="dropdown-menu pull-right"><li><a href="'+asc+'" '+opt.order_attr+' data-div="'+opt.contenedor+'"><i class="icon-caret-up icon-expand"></i>Ascendente</a></li><li><a href="'+desc+'" '+opt.order_attr+' data-div="'+opt.contenedor+'"><i class="icon-caret-down icon-expand"></i>Descendente</a></li></ul></div>');
                                    }
                                }
                                
                            });  
                                                        
                            // Creo las columnas para mostrar/ocultar 
                            if (opt.col_collapse && th.hasClass(opt.col_collapse) ) {
                                //Regisro las columnas
                                text = th.text();
                                text = text.substr(0,1).toUpperCase()+text.substr(1,text.length).toLowerCase();
                                var toggle = $('<li><label class="checkbox" for="toggle-col-'+i+'">'+text+'<input type="checkbox" name="toggle-cols" id="toggle-col-'+i+'" value="'+id+'" /></label></li>');
                                //Agrego las columnas que se pueden ocultar
                                containerCol.find("ul").append(toggle);                                 
                                toggle.find("input").change(function(){                                    
                                    var input = $(this), 
                                    val = input.val(), 
                                    cols = $("#" + val + ", [headers="+ val +"]", table);	                                                   
                                    (input.is(":checked")) ? cols.removeClass('hidden') : cols.addClass('hidden');
                                    //(input.is(":checked")) ? cols.attr('style', 'display: block !important'): cols.css('display', 'none');
                                }).bind("updateCheck", function(){
                                    if (th.hasClass('hide')) {
                                        $(this).attr("checked", false);
                                    } else {
                                        $(this).attr("checked", true);
                                    }                                    
                                }).trigger("updateCheck");                                <commit_msg>Se corrige bug en el dwgrig al ocultar las columnas<commit_after>(function($){     
    
    var methods = {  
        
        init : function( options ) { 
                    //Defino unas opciones por defecto
                    var opt = {                        
                        form_search     : true,
                        form_action     : '',
                        form_col        : 'data-search',
                        form_attr       : 'class="dw-form js-remote form-search"',
                        order_attr      : 'class="dw-ajax data-order dw-spinner"',
                        col_collapse    : 'col-collapse',
                        order_action    : '',
                        contenedor      : 'dw-shell-content'
                    }            
                    
                    $.extend(opt, options); //Extiende las opciones recibidas con las default
                    
                    return this.each(function(k) {  
                        
                        var table = $(this); //Tomamos el objeto tansformado en jquery                                                                                        
                        
                        thead = table.find("thead");
                        tbody = table.find("tbody");
                        hdrCols = thead.find("th");
                        bodyRows = tbody.find("tr");                                                
                        
                        if(table.parent().hasClass('dw-overflow')) {                             
                            container = table.parent().prev().hasClass('btn-toolbar') ? table.parent().prev() : $('<div class="btn-toolbar btn-toolbar-top"></div>');
                        } else {
                            container = table.prev().hasClass('btn-toolbar') ? table.prev() : $('<div class="btn-toolbar btn-toolbar-top"></div>');
                        }                                                
                        
                        containerCol = $('<div class="pull-right"><div class="btn-group"><button class="btn btn-only dropdown-toggle" data-toggle="dropdown"><span class="hidden-tablet hidden-phone"> COLUMNAS <i class="caret"></i></span><span class="hidden-desktop"><i class="icon-th"></i></span></button><ul class="dropdown-menu pull-right" /></div></div>');
                        
                        var th_responsive = [];
                        
                        hdrCols.each(function(i) {  
                            
                            var th = $(this), classes = th.attr("class");
                            //Se asigna un id a la colomna definida en el thead                            
                            var id = "col-"+k+"-"+ i;
                            th.attr("id", id);   
                                                        
                            if(!th.hasClass('no-responsive')) {
                                th_responsive.push('td:nth-of-type('+(i+1)+'):before { content: "'+th.text()+': "; }');
                            }
                                                        
                            // Hay que revisar los colspan
                            bodyRows.each(function(){
                                var cell = $(this).find("th, td").eq(i);                        
                                cell.attr("headers", id);                                
                                if (classes) { cell.addClass(classes); };
                                
                                if(opt.order_action!='') {
                                    if(th.attr('data-search')!=undefined) {                                    
                                        text = th.text();
                                        order = th.attr('data-search');
                                        asc = opt.order_action+'order.'+order+'.asc/';
                                        desc = opt.order_action+'order.'+order+'.desc/';
                                        cell.append('<div class="btn-group hidden-desktop"><a class="" data-toggle="dropdown" href="#"><span class="caret"></span></a><ul class="dropdown-menu pull-right"><li><a href="'+asc+'" '+opt.order_attr+' data-div="'+opt.contenedor+'"><i class="icon-caret-up icon-expand"></i>Ascendente</a></li><li><a href="'+desc+'" '+opt.order_attr+' data-div="'+opt.contenedor+'"><i class="icon-caret-down icon-expand"></i>Descendente</a></li></ul></div>');
                                    }
                                }
                                
                            });  
                                                        
                            // Creo las columnas para mostrar/ocultar 
                            if (opt.col_collapse && th.hasClass(opt.col_collapse) ) {
                                //Regisro las columnas
                                text = th.text();
                                text = text.substr(0,1).toUpperCase()+text.substr(1,text.length).toLowerCase();
                                var toggle = $('<li><label class="checkbox" for="toggle-col-'+i+'">'+text+'<input type="checkbox" name="toggle-cols" id="toggle-col-'+i+'" value="'+id+'" /></label></li>');
                                //Agrego las columnas que se pueden ocultar
                                containerCol.find("ul").append(toggle);                                 
                                toggle.find("input").change(function(){                                    
                                    var input = $(this), 
                                    val = input.val(), 
                                    cols = $("#" + val + ", [headers="+ val +"]", table);	                                                   
                                    (input.is(":checked")) ? cols.removeClass('hidden').css('display','block') : cols.addClass('hidden').css('display','none');
                                    //(input.is(":checked")) ? cols.attr('style', 'display: block !important'): cols.css('display', 'none');
                                }).bind("updateCheck", function(){
                                    if (th.hasClass('hide')) {
                                        $(this).attr("checked", false);
                                    } else {
                                        $(this).attr("checked", true);
                                    }                                    
                                }).trigger("updateCheck");                                
{'fraction_non_alphanumeric': 0.12966185036689615, 'fraction_numerical': 0.0006051894999621756, 'mean_word_length': 0.826471400939486, 'pattern_counts': {'":': 4, '<': 91, '<?xml version=': 0, '>': 91, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 94, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4257483', 'n_tokens_mistral': 2892, 'n_tokens_neox': 2726, 'n_words': 465}