Thursday, 23 February 2012

Personalising DispForm.aspx with JQuery for SharePoint 2010










    The above will give the following






    JQuery and SharePoint

    This works for me...








    Wednesday, 22 February 2012

    Load SharePoint JavaScript Libraries on SharePoint CEWP

    I spent 4 hours wondering why my SharePoint code did not run automatically when I did a _spBodyOnLoadFunctionNames but works when I did an onclick.

    The reason behind this was that the SharePoint javascript Libraries have not been loaded fully when SP. functions were called, thus nothing happened, that is for example SP.ClientContext did not exist yet.



    _spBodyOnLoadFunctionNames.push("LoadLastURL");

    function LoadLastURL()
    {
    var myQueryString = "1";

    var myContext = new SP.ClientContext.get_current();
    ...
    }



    The solution was simple, I just have to do the following





    SP.SOD.executeOrDelayUntilScriptLoaded(LoadLastURL, 'SP.js');


    function LoadLastURL()
    {
    ...sharepoint javascript functions ....
    }

    Friday, 17 February 2012

    Sharepoint 2010: Load parent page to new URL after Item Added

    I was assigned a task for users to be redirected to a page when the new item dialog closes, after figuring things out for 2 days and trawling through google. This is what I came up with.

    The following code will show an Add New Item link, and when the user clicks on the added new URL, he/she will be redirected to that new page in the parent window.




    Add New Item