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

The total number of results that come back is within the <rs:data> node.  The attribute you want to get at is `ItemCount`.  So you'll want to pull all of the items from the list, then count the number of `Complete` items.  I'm doing this all from memory, so you may want to look at the response to see if this is all correct.  Here's an example (totally not tested either...):

 

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("ColumnForComplete") === "Complete" ) {
			totalComplete++;
		}
	}if ( itemTotal !== 0 ) {
		percentage = totalComplete / itemTotal;
	}
}

 

 

Cheers,
Matthew 


Viewing all articles
Browse latest Browse all 6517

Trending Articles



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