3

Im using sharepoint Data View Web Part, I just want to get the Count of recently added items count from list mean which have "NEW" tags

enter image description here

the above image has two new items so it should show "2" in count ...

  • How are you trying to fetch the data? JavaScript? – Nagarajan Muthukumar Dec 24 '15 at 10:14
  • No,we are using default data viewer webpart. – sivajn Dec 24 '15 at 10:18
  • You can change in XSLT file of data view web part. Add your business logic in XSLT file and data view web part to site. – Dipen Shah Dec 24 '15 at 11:15
  • You could just count items where the created date is greater than or equal to 3 midnight's in the past. So let's say I created an item right now (12/24 9:26 am). It's marked new because it was created after 12/22 12am. – Erin L Dec 24 '15 at 15:27
1

You can use JSLink to add both the jQuery library and an external .js on the data view web part like this:

~site/Style%20Library/js/jquery-1.11.3.min.js|~site/Style%20Library/js/newitemscount.js

and add the following code:

$(document).ready(function(){
    var newItemsCount = $(".ms-newdocument-iconouter").length + " new items";
    $("#pageTitle").append(newItemsCount).wrap("<span/>")
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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