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.
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
Post a Comment