SharePoint 2010 List View Header Count of Rows

Hi All,

Sometimes we need to show the number of rows in the header itself when we have created an accordion on the webpart header.below is the code which helps us display count of the rows.


$(".s4-wpTopTable").each(function(){


var countOfRows=   $(this).find(".ms-listviewtable").find("tr .ms-vb2:first-child").length;


  $(this).find(".ms-WPTitle a span:first-child").append("<b> (" + countOfRows + ")</b>");



});



Edit: ID column is needed in the list view to display the count.Working on it so that this can be eliminated.

Comments

Popular posts from this blog

Install Node.js without admin rights

Create a lean React Solution using Typescript

Replace all occurence of String in JavaScript