如何根据状态将颜色应用于 SharePoint 列表?

发布于 2024-09-03 05:49:54 字数 66 浏览 2 评论 0原文

我想根据状态或类似情况将颜色应用于 SharePoint 列表的行。

请有人详细告诉我如何做到这一点。

I would like to apply colours to a SharePoint List's rows based on status or similar.

Please could someone tell me in detail how to do this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

幸福%小乖 2024-09-10 05:49:54

有很多关于优秀的SharePoint 博客路径的帖子关于这个主题。

我不会列出各个帖子,但该技术称为“Html 计算列'。

There are a lot of posts on the excellent Path To SharePoint blog regarding this subject.

I am not going to list the individual posts, but the technique is called the 'Html Calculated Column'.

薄情伤 2024-09-10 05:49:54

虽然这个答案很晚了,但这个问题仍然被很多人问到。

我总结了执行此操作的可能方法,并提供了具有更详细演练的页面的链接(包括 @Muhimbi 提到的 Christophe 的解决方案):

如何在 SharePoint 中突出显示列表

这是我公司的博客[抱歉],灵感来自于创建具有此功能的商业产品[抱歉]< /em>,我不可避免地会在博客中提到该产品[立即购买抱歉]

Although this is a late answer, this question still gets asked a lot.

I've put together a summary of the possible methods of doing this, with links to pages that have more detailed walkthroughs (including Christophe's solution mentioned by @Muhimbi):

How to do list highlighting in SharePoint

It's my company's blog [sorry], and was inspired by creating a commercial product that has this functionality [sorry], and I inevitably mention the product in the blog [buy now sorry].

塔塔猫 2024-09-10 05:49:54

下面的代码突出显示并根据

SharePoint 设计器中的某些表格单元格数值条件格式将样式添加到父(最近)表格行,但我期望的方式和使用此 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>

below code highlight and add style to parent (closest) table row based on some table cell numeric value

conditional formatting in SharePoint designer was not working right and the way i expected and using this jquery code is much better

<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>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文