2

We have a web part for a discussion board on SharePoint 2013 (Enterprise) that we would like to be able to hide items for each user as they view them.

So for example:

  • Item 1 has been created and no one has viewed it so it is visible in the web part.
  • User A clicks on the item to view the entire post.
  • The next time User A goes to the web part page with the Discussion Board web part, he no longer sees Item 1.
  • When User B views the web part page afterward, he still sees Item 1.

I assume I would need to use a Content Query web part to filter the view based on a "viewed" column somehow, but I am not sure how to gather the "viewed" data into the column in the first place.

Any assistance would be greatly appreciated!

0

Add a content editor web part to your page and insert the following script. Will only work if you there is only one list on the page.

   <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        $('.ms-listviewtable a').click(function() {
        $(this).closest('tr').toggle();
        });
        });
    </script>​
  • Hi Ramana, When I add this to a web part page with a list it does remove the item as I click on it, but as soon as I come back to the page the item is there again. Also, this seems to only work like this for a list, where I would like the solution to be for a Discussion Board type of app. – Brandon Elwell Mar 15 '16 at 14:25
  • This is basically manipulating the CSS to hide the items when viewed. To make a more permanent solution that doesn't refresh when you navigate to the page, you would most likely need to add code to your list item. To make the existing code work for a discussion board add the following right above $('.ms-listviewtable ...etc) bit. $('.ms-vb-title a').removeAttr('onclick').attr('target', '_blank'); – Ramana Viswanadha Mar 15 '16 at 15:57
  • Thanks, I am definitely looking for a more permanent solution however. – Brandon Elwell Mar 15 '16 at 21:20

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.