2010-05-25 69 views

回答

0

雖然這是一個遲到的答案,但這個問題仍然被問到很多。

我已經把這樣的可能方法的總結,與鏈接到有更詳細的演練(包括@Muhimbi提到克里斯托夫的解決方案)網頁:

How to do list highlighting in SharePoint

這是我公司的博客[對不起],並通過創建一個具有此功能[對不起]商業產品的啓發,我不可避免地提及該產品在博客[ 現在購買 對不起]

0

下面的代碼高亮顯示並添加樣式母公司基於一些表格單元格的數值(接近)錶行

在SharePoint Designer條件格式是不工作的權利,我所期望的方式使用該jQuery代碼好得多

<script src="https://portal/SiteAssets/jsLibrary/jquery.1.9.1.min.js" type="text/javascript"></script> 

<script type="text/javascript"> 
jQuery.noConflict(); 

jQuery(document).ready(function() { 
// Wait until SP.JS has loaded before calling ConditionalFormatting 
    ExecuteOrDelayUntilScriptLoaded(ConditionalFormatting, "sp.js"); 
}); 

    function ConditionalFormatting(){ 
     jQuery('table[id*="7011A98DAFA5"] tbody td').each(function(){ 
      var valD=parseFloat(jQuery(this).text()); 
      if (valD== 0.16){ 
       jQuery(this).closest('tr').css('background-color','yellow') 
      } 
      else if (valD > 0.16){ 
       jQuery(this).closest('tr').css({'background-color':'red'}) 
      } 
      else if (valD< 0.16){ 
       jQuery(this).closest('tr').css('background-color','green') 
      } 
     }); 
    } 


</script>