1

I created a new sharepoint content type with created custom columns, then created a new task list. I made my content type as default. If I try to get the value of my created columns (text) I get an undefined (of course I use the internal name of the column).

Do I get only the value of default sharepoint columns? Or am I missing something?

(function (){
    //init
    var inCtx = {};
    var mfield = {};
    inCtx.Templates = {};

    inCtx.Templates.Item = ItemOverride;

    inCtx.Templates.Header = "<div>";
    inCtx.Templates.Footer = "</div>";

    SPClientTemplates.TemplateManager.RegisterTemplateOverrides(inCtx);

    function ItemOverride(itemCtx){
        var result = "";
        result += "<h4>";
        result += itemCtx.CurrentItem.Title + " ";
        result += itemCtx.CurrentItem["MYCOLUMN"];
        result += "</h4>";

        return result;
    }

})();

I added console.log(itemCtx.CurrentItem) to my function:

AssignedTo:Array[1]
Checkmark:"Nein"
ContentType:"MY CONTENT TYPE"
ContentTypeId:"0x010800B190D14F1764B34B90CEC6190DEBEA2D00CAA91C9504256348A9CD224C2E078360"
Created_x0020_Date.ifnew:"1"
DueDate:"19.08.2016"
DueDate.FriendlyDisplay:"1|1|7|Freitag"
FSObjType:"0"
FileLeafRef:"1_.000"
FileRef:"/sites/mr_demo/Lists/Zieleliste/1_.000"
File_x0020_Type:""
File_x0020_Type.mapapp:""
HTML_x0020_File_x0020_Type.File_x0020_Type.mapcon:""
HTML_x0020_File_x0020_Type.File_x0020_Type.mapico:"icgen.gif"
ID:"1"
PercentComplete:"0 %"
PercentComplete.:"0"
PermMask:"0x7fffffffffffffff"
Title:"Task 1"
firstRow:true
outlineLevel:"1"
__proto__:Object
6
  • Custom column that you need to display, Is that in the view ?
    – Ravindra
    Aug 17, 2016 at 8:12
  • Yes it is in the view and i need to display it. Aug 17, 2016 at 8:45
  • add a console.log(itemCtx) inside the function and see what you get in the F12 console Aug 17, 2016 at 9:26
  • @Danny'365CSI'Engelman I get a object with a lot of information. Should I look for something specific? Aug 17, 2016 at 9:43
  • Check for itemCtx‌​.CurrentItem
    – Ravindra
    Aug 17, 2016 at 9:57

1 Answer 1

0

Fixed it!

I had to click Edit Page -> Edit Webpart. There I changed the view from "< Current View >" explicit to the View - even if it was the same.

Now I can get my stuff done, thx @all!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.