質問

I added a list view to a page. The List contain two columns "Title" and "ReleaseDate". The "Title" is the default column when I create the list. I have not changed the column name.

Here is part of my CSR js code. I call "ReleaseDateViewTemplate" for Title field by purpose. So that I can count how many "Hi" is returned.

overrideCtx.Templates.Fields = {
                "Title": {
            "View": ReleaseDateViewTemplate
        },
        "ReleaseDate": {
            "View": ReleaseDateViewTemplate
        }
    };

function ReleaseDateViewTemplate(ctx) 
{
    alert("hi");
    var date  = ctx.CurrentItem[ctx.CurrentFieldSchema.Name];
    var monthNames = [ "January", "February", "March", "April", "May", "June","July", "August", "September", "October", "November", "December" ]; 
    var d = new Date(date);
    return "<div class='dateBox'><div class='dayDateBox'>" + d.getDay() + "</div><div class='monthDateBox' >" +  monthNames[d.getMonth()] + "</div></div>";
}

According to my experiment, the ReleaseDateViewTemplate function have not been rendered on the Title field. But it rendered for ReleaseDate field. Any advice to debug it? Thanks.

役に立ちましたか?

解決

The field name used in CSR code (I think it is not called "Internal field name" as it is referring another value?) for TITLE field are:

  • Title (Title only, no link)
  • LinkTitle (Title with link and with "..." suffix to open a dropdownmenu)
  • LinkTitleNoMenu (Title with link to the document or file but no "..." suffix)

I cannot find any official reference about these field names.

In my code mentioned in question, I replace "Title" to "LinkTitleNoMenu" and everything is working.

ライセンス: CC-BY-SA帰属
所属していません sharepoint.stackexchange
scroll top