Skip to content

Instantly share code, notes, and snippets.

@srkmrs
Last active December 20, 2015 22:59
Show Gist options
  • Select an option

  • Save srkmrs/6209447 to your computer and use it in GitHub Desktop.

Select an option

Save srkmrs/6209447 to your computer and use it in GitHub Desktop.

Revisions

  1. Sreekumar Sasidharan revised this gist Aug 12, 2013. 1 changed file with 23 additions and 26 deletions.
    49 changes: 23 additions & 26 deletions hide_empty_row
    Original file line number Diff line number Diff line change
    @@ -14,11 +14,10 @@ hideEmptyRows(10);

    function hideEmptyRows(delay){
    if(delay){
    /**
    The following style applied for testing purpose.
    Please comment in production mode
    **/
    /** The following style applied for testing purpose.**/

    $( "div.row" ).css( "border", "1px solid green" );

    setTimeout(findAndHideEmptyRows,delay);
    }else{
    findAndHideEmptyRows();
    @@ -28,31 +27,29 @@ function findAndHideEmptyRows(){

    $("div.row:empty").css("display","none");

    /**
    If browser does not support the above expression,
    Please uncomment the following script and run.
    **/
    /** If browser does not support the above expression,
    Please uncomment the following script and run. **/


    /*
    $("div.row" ).each(function( index ) {
    var content = $(this).text();
    var display = false;
    if(content != null){
    content = $.trim(content);
    if(content.length > 0){
    display = true;
    }else{
    display = false;
    $("div.row" ).each(function( index ) {
    var content = $(this).text();
    var display = false;
    if(content != null){
    content = $.trim(content);
    if(content.length > 0){
    display = true;
    }else{
    display = false;
    }
    }
    if(!display){
    $(this).css("display","none");
    }
    }
    if(!display){
    $(this).css("display","none");
    }
    });*/
    });
    */

    /**
    The applied style removed after testing.
    Please comment in production mode
    **/
    /** The applied style removed after testing. **/
    $( "div.row" ).css( "border", "0px" );

    }
  2. Sreekumar Sasidharan created this gist Aug 12, 2013.
    58 changes: 58 additions & 0 deletions hide_empty_row
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,58 @@
    /**
    Once the dom is rendered or ready , invoke or call the method named hideEmptyRows.
    How to call
    hideEmptyRows(1000);
    or
    hideEmptyRows();

    Preferable
    hideEmptyRows(10);
    **/




    function hideEmptyRows(delay){
    if(delay){
    /**
    The following style applied for testing purpose.
    Please comment in production mode
    **/
    $( "div.row" ).css( "border", "1px solid green" );
    setTimeout(findAndHideEmptyRows,delay);
    }else{
    findAndHideEmptyRows();
    }
    }
    function findAndHideEmptyRows(){

    $("div.row:empty").css("display","none");

    /**
    If browser does not support the above expression,
    Please uncomment the following script and run.
    **/
    /*
    $("div.row" ).each(function( index ) {
    var content = $(this).text();
    var display = false;
    if(content != null){
    content = $.trim(content);
    if(content.length > 0){
    display = true;
    }else{
    display = false;
    }
    }
    if(!display){
    $(this).css("display","none");
    }
    });*/

    /**
    The applied style removed after testing.
    Please comment in production mode
    **/
    $( "div.row" ).css( "border", "0px" );

    }