Show count of results?

Feb 7, 2016 at 8:04 PM
Edited Feb 8, 2016 at 11:13 AM
Is there a way to do this?

I am trying to with the hide/show function but have had no luck.

here is my code so far:
<script src="http://www.google.com/jsapi"></script>

<script>

var columnCount = -1;

var test = 0;

google.load("jquery", "1.2.6");

google.setOnLoadCallback(function() { 

$(document).ready(function()
{   
    jQuery.extend(jQuery.expr[':'], {
      containsIgnoreCase: "(a.textContent||a.innerText||jQuery(a).text()||'').toLowerCase().indexOf((m[3]||'').toLowerCase())>=0"
    });

    
    $("table.ms-listviewtable tr.ms-viewheadertr").each(function()
    {
        if($("td.ms-vh-group", this).size() > 0)
        {
            return; 
        }
        
        var tdset = "";
        
        var colIndex = 0;
        
        $(this).children("th,td").each(function()
        {
            if($(this).hasClass("ms-vh-icon"))
            {
                // attachment
                tdset += "<td></td>";
            }
            else
            {
                // filterable
                tdset += "<td id='" + colIndex + "'><input type='text' class='vossers-filterfield' filtercolindex='" + colIndex + "' /></td>";              
            }
            
            colIndex++;
        columnCount++;
        });
        
        //Clear Btn
        tdset += "<td id='" + colIndex + "'><input type='submit' value='Clear Criteria' id='clickMe'</td>";

        var tr = "<tr class='vossers-filterrow'>" + tdset + "</tr>";
        
        var test1 = "<div id='ah'>hi mom</div>";
        
        $(tr).insertAfter(this);

        $(test1).insertAfter(this);
    }); 
    
    
    $("input.vossers-filterfield")
        .css("border", "1px solid #7f9db9")
        .css("width", "90%")
        .css("margin", "2px")
        .css("padding", "2px")
        .keyup(function()
        {           
            var inputClosure = this;
            
            if(window.VossersFilterTimeoutHandle)
            {
                clearTimeout(window.VossersFilterTimeoutHandle);
            }
            
            window.VossersFilterTimeoutHandle = setTimeout(function()
            {
                var filterValues = new Array();
                
                $("input.vossers-filterfield", $(inputClosure).parents("tr:first")).each(function()
                {               
                    if($(this).val() != "")             
                    {
                        filterValues[$(this).attr("filtercolindex")] = $(this).val();
                    }
                });     
                
                            
                $(inputClosure).parents("tr.vossers-filterrow").nextAll("tr").each(function()
                {
                    var mismatch = false;
                    
                    $(this).children("td").each(function(colIndex)
                    {
                        if(mismatch) return;
                        
                        if(filterValues[colIndex])
                        {
                            var val = filterValues[colIndex];
                            
                            // replace double quote character with 2 instances of itself
                            val = val.replace(/"/g, String.fromCharCode(34) + String.fromCharCode(34));                         
                                                                                
                            if($(this).is(":not(:containsIgnoreCase('" + val + "'))"))
                            {
                                mismatch = true;
                            }                       
                        }
                    });
                    //test =0;
                    if(mismatch)
                    {
                        $(this).hide();
                    }
                    else
                    {
                        $(this).show();
test++;
        var test12 = "<div id='ah'>Results: " + test + "</div>";

                    
        $(test12).insertAfter(this);
                    }       


                });



                //document.getElementById('ah').innerHTML += 'hello two';
                //alert(test);
test =0;
            }, 250);
        });
});
//alert(columnCount);
});

</script>

Feb 8, 2016 at 5:44 PM
Here is the updated code. This code shows the results found on the top left. Enjoy!
<script src="http://www.google.com/jsapi"></script>

<script>

var columnCount = -1;

var resultCount = 0;

google.load("jquery", "1.2.6");

google.setOnLoadCallback(function() { 

$(document).ready(function()
{   
    jQuery.extend(jQuery.expr[':'], {
      containsIgnoreCase: "(a.textContent||a.innerText||jQuery(a).text()||'').toLowerCase().indexOf((m[3]||'').toLowerCase())>=0"
    });

    
    $("table.ms-listviewtable tr.ms-viewheadertr").each(function()
    {
        if($("td.ms-vh-group", this).size() > 0)
        {
            return; 
        }
        
        var tdset = "";
        var tdset2 = "";
        var colIndex = 0;
        
        $(this).children("th,td").each(function()
        {
            if($(this).hasClass("ms-vh-icon"))
            {
                // attachment
                tdset += "<td></td>";
            }
            else
            {
                // filterable
                tdset += "<td id='" + colIndex + "'><input type='text' class='vossers-filterfield' filtercolindex='" + colIndex + "' /></td>";              
            }
            
            colIndex++;
        columnCount++;
        });
        
        //Clear Btn
        tdset += "<td id='" + colIndex + "'><input type='submit' value='Clear Criteria' id='clickMe'</td>";
        
        //Results
        tdset2 += "<br/><div id='ah' style='font-weight: bold'></div>";

        var tr = "<tr class='vossers-filterrow'>" + tdset + "</tr><tr class='vossers-filterrow'>";
        
        var tr2 = "<tr class='vossers-filterrow'>" + tdset2 + "</tr>";      

        $(tr).insertAfter(this);

        $(tr2).insertBefore(this);
    }); 
    
    
    $("input.vossers-filterfield")
        .css("border", "1px solid #7f9db9")
        .css("width", "90%")
        .css("margin", "2px")
        .css("padding", "2px")
        .keyup(function()
        {           
            var inputClosure = this;
            
            if(window.VossersFilterTimeoutHandle)
            {
                clearTimeout(window.VossersFilterTimeoutHandle);
            }
            
            window.VossersFilterTimeoutHandle = setTimeout(function()
            {
                var filterValues = new Array();
                
                $("input.vossers-filterfield", $(inputClosure).parents("tr:first")).each(function()
                {               
                    if($(this).val() != "")             
                    {
                        filterValues[$(this).attr("filtercolindex")] = $(this).val();
                    }
                });     
                
                            
                $(inputClosure).parents("tr.vossers-filterrow").nextAll("tr").each(function()
                {
                    var mismatch = false;
                    
                    $(this).children("td").each(function(colIndex)
                    {
                        if(mismatch) return;
                        
                        if(filterValues[colIndex])
                        {
                            var val = filterValues[colIndex];
                            
                            // replace double quote character with 2 instances of itself
                            val = val.replace(/"/g, String.fromCharCode(34) + String.fromCharCode(34));                         
                                                                                
                            if($(this).is(":not(:containsIgnoreCase('" + val + "'))"))
                            {
                                mismatch = true;
                            }                       
                        }
                    });

                    if(mismatch)
                    {
                        $(this).hide();
                    }
                    else
                    {
                        $(this).show();
                    resultCount++;

                    }       
                //if (resultCount == 31)
//{
//resultCount = 30;
//}
                
                });
                
                var results = "Results:&nbsp" + resultCount;
                
                $('#ah').html(results);
                
                //alert(resultCount);
            resultCount = 0;
            }, 250);
        });
});
//alert(columnCount);
});

</script>
Marked as answer by MethodDev on 2/8/2016 at 9:44 AM