2

I am trying to reorder casual sharepoint list view which looks like this:

Casual sharepoint list with like function

To look like this:

Desired list view

I am using JSLink and I have no problem with normal text fields like "Title" or "Description" but I dont know how to add "Like" funcionalites to my desired view.

Here is the code which I have (link to a tutorial):

var mjhViews = mjhViews || {};

mjhViews.itemHtml = function (ctx) {
    // start with a <tr> and a <td>
    var returnHtml = "<tr><td colspan='3'>";

    returnHtml += "<h2>" + ctx.CurrentItem.Title + "</h2>";

    if (ctx.CurrentItem.MyCustomField) {
        returnHtml += "<p>" + ctx.CurrentItem.MyCustomField + "</p>";
    }
    // close off our <td> and <tr> elements
    returnHtml += "</td></tr>";
    return returnHtml;
};

(function () {
    var mjhOverrides = {};
    mjhOverrides.Templates = {};

    mjhOverrides.Templates.Header = "<div id='MyCustomView'>";
    mjhOverrides.Templates.Item = mjhViews.itemHtml;
    mjhOverrides.Templates.Footer = "</div>";

    mjhOverrides.ListTemplateType = 100;
    mjhOverrides.BaseViewID = 1;

    SPClientTemplates.TemplateManager.RegisterTemplateOverrides(mjhOverrides);
})();

I spent few days on looking for solution so any help will be appreciated.

1 Answer 1

1

did quite the same in my environment.

enter image description here

You can take a look into my guideline I wrote here:

https://afrait.com/blog/like-list-items-facebook-like-en

2
  • Google didn't catch that guide... What more can I say. I think this is my solution so thank you friend. Commented Nov 25, 2015 at 14:58
  • My blog isn't that popular by now. Hopefully google will catch up ;) If you still have questions, don't be afraIT to ask
    – Patrick
    Commented Nov 25, 2015 at 15:03

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.