如何在SharePoint 2007列表中具有特定文本的行中添加颜色?
我想知道如何在Sharepoint 2007列表中的行中添加颜色 如果在一个字段中包含特定文本?
I would like to know how to add a color to a line in sharepoint 2007 list if in one field there is a specific text contained ?
例如: 我有一个包含三个字段的列表:
for example : I have a list that have three fields:
1.id 2.名称 3.完整说明
1.id 2.name 3.full description
现在我只想向用户显示第一和第二字段.
now i want to show only the first and the second field to the user.
id名称
1 abc 2 edv
1 abc 2 edv
第二件事,我想给隐藏的行提供一种颜色(让我们说红色) 字段-完整说明",例如带有颜色"一词的文本.
second thing, i want to give a color (let say red) to a row that contains in the hidden field - "full description", a text with the word for example 'color'.
我找到了可以添加到aspx页面的javascript代码:
I found a javascript code that i can add to the aspx page :
(文档).ready(function(){ $ Text = $("td .ms-vb2:contains('color')"); $ Text.parent().css("background-color","red"); });
(document).ready(function(){ $Text = $("td .ms-vb2:contains('color')"); $Text.parent().css("background-color", "red"); });
,但只有在显示完整说明"的情况下,它才有效.
but it's only works if the the "full description" is shown.
有人可以给我一个主意吗?
can someone give me an idea ?
谢谢, 加迪姆
您是否考虑过使用条件格式创建数据视图?请参阅 http://office.microsoft.com/en-au/sharepointdesigner/HA100996241033 .aspx
Have you considered creating a data view with conditional formatting? See http://office.microsoft.com/en-au/sharepointdesigner/HA100996241033.aspx
那样,您就不必进行这种丑陋的JavaScript黑客攻击了:)
That way you won't have to do this ugly javascript hacking :)