Guest User

Untitled

a guest
Jan 23rd, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. <style>
  2. .tooltip {
  3. position: relative;
  4. display: inline-block;
  5. }
  6.  
  7. .tooltip .tooltiptext {
  8. visibility: hidden;
  9. margin-left:180px;
  10. background-color: blue;
  11. color: #fff;
  12. text-align: center;
  13. border-radius: 6px;
  14. padding: 5px 0;
  15. /* Position the tooltip */
  16. position: absolute;
  17. z-index: 1;
  18. }
  19.  
  20. .tooltip:hover .tooltiptext {
  21. visibility: visible;
  22. }
  23. </style>
  24. <script src="https://code.jquery.com/jquery-1.12.4.min.js" type="text/javascript"></script>
  25. <script type="text/javascript">
  26. $(function(){
  27. var listName="Policies and Procedure";
  28. $(".ms-listviewtable tbody[id^='titl']").each(function(){
  29. var policies=$(this).text().split(":")[1].split("(")[0].trim();
  30. var html=getDocuments(listName,policies);
  31. $(this).find("a").addClass("tooltip");
  32. $(this).find("a").append(html);
  33. });
  34. })
  35. function getDocuments(listName,filter){
  36. var html="<span class='tooltiptext'>";
  37. $.ajax({
  38. url: _spPageContextInfo.siteAbsoluteUrl + "/_api/web/lists/getbytitle('" + listName + "')/items?$select=FileLeafRef&$filter=Policies eq '"+filter+"'",
  39. type: "GET",
  40. async:false,
  41. headers: {
  42. "Accept": "application/json;odata=verbose",
  43. },
  44. success: function (data) {
  45. $.each(data.d.results,function(i,item){
  46. html+="<p>"+item.FileLeafRef+"</p>";
  47. });
  48. },
  49. error: function (data) {
  50. alert("Error");
  51. }
  52. });
  53. html+="</span>";
  54. return html;
  55. }
  56. </script>
Add Comment
Please, Sign In to add comment