0

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?

2 Answers 2

0

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

0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.