I am using this caml query to select all items in a sharepoint list that were recently modified. Now I want to add some kind of icon to the title as an identifier that the item was modified. Kind of like the new.png that sharepoint uses.
<Where>
<Gt>
<FieldRef Name='Modified' />
<Value Type='DateTime'>
<Today Offset='-7' />
</Value>
</Gt>
</Where>
Update: Does anyone have an example of this?
Marco
Show Modified in your list view,then select eligible items in csr and add icons.
<script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>
<script>
(function () {
var overrideCurrentContext = {};
overrideCurrentContext.Templates = {};
overrideCurrentContext.OnPostRender = renderItem;
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideCurrentContext);
})();
function renderItem() {
var rows = ctx.ListData.Row;
for (var i = 0; i < rows.length; i++) {
var Modified = rows[i]["Modified"];
console.log(Modified)
var SevenDaysAgo= new Date(new Date().getTime()-24*60*60*1000*7);
if(SevenDaysAgo.getTime()<new Date(Modified).getTime()){
var rowId = GenerateIIDForListItem(ctx, rows[i]);
var row = document.getElementById(rowId);
$(row).find("td>div[field='LinkTitle']").append("<img src='http://sp/Shared%20Documents/download.png'/>");
}
}
ctx.skipNextAnimation = true;
}
</script>