Question

usually the value of count is displayed at the top of the column,so is it possible to get the value of that count and display it anywhere else like in a html textbox or on a label on the same page?

Was it helpful?

Solution

XSLT is one option, there are more.

I say CSR-Client Side Rendering on SP2013

But there is some undocumented (and maybe a bit dirty) trickery which works in both 2010 and 2013/Online.

Paste this Formula in a Calculated Column (in the List only, do not add it to existing Content Types), set the datatype to Number:

="<img src=/_layouts/images/blank.gif onload=""{"
&"var T=this;while(T.tagName!='TABLE'){T=T.parentNode}"
&"document.getElementById('pageTitle').innerHTML=T.rows.length+' rows in this list';"
&"}"">"

datatype Number will have it execute as HTML/Javascript. But Microsoft disabled use of the SCRIPT tag in summer 2013, so we use a blank IMG to trigger an onload event. Ofcourse those 2 lines of JavaScript will be executed for every List Item.

Add a <DIV id='myCounter'> to the page, change the JS code to reference your DIV... et voila..

Note: The Javascript is executed INLINE, while the page is still loading. So Add the DIV above the List View WebPart! because all content below hasn't loaded yet.

More explanation at https://www.365csi.nl/vm365com/#/How

OTHER TIPS

This question was answered in this StackExchange question that has you editing the XSL files through SharePoint designer.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top