Quantcast
Channel: jQuery Library for SharePoint Web Services
Viewing all articles
Browse latest Browse all 6517

New Post: Get an item count for a SharePoint list

$
0
0

here is the code Im using, which essentially is a copy/paste of the code provided:

 



<script language="javascript" type="text/javascript">

    $(document).ready(function() {

    completefunc: function( xData, Status ) {
 var $xData = $(xData.responseXML),
  itemTotal = 0,
  totalComplete = 0,
  percentage = 0
  
 ;
 
 itemTotal = $xData.SPFilterNode("rs:data").attr("ItemCount") * 1;
 
 $xData.SPFilternode("z:row").each(function(i, el) {
  var $node = $(this)
  
  ;
  
  if ( $node.attr("PM_Value") === "Complete" ) {      //This is the display name for the column. The field reference name is "PM%5FValue"
   totalComplete++;
  }
 }
 
 if ( itemTotal !== 0 ) {
  percentage = totalComplete / itemTotal;
 }
        alert("Total items: " + itemTotal);
        alert("Percentage complete: " + percentage);
 
     }

 

    });

</script>


Viewing all articles
Browse latest Browse all 6517

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>