none
Project Server 2013 : Retrieve selected projects from the Project Center View on PWA Ribbon RRS feed

  • Question

  • Hi,

    I need to get Project IDs of the selected projects from Project Center View on the click of a PWA Ribbon control.

    I have referred this link https://msdn.microsoft.com/EN-US/library/office/ff535984%28v=office.14%29.aspx

    But somehow I'm not able to get the _grid object.

    Any help is appreciated.

    Regards,

    Pramila

    Monday, March 16, 2015 9:31 AM

All replies

  • Hi,

    Got this resolved in PS2013 by using below code.

    From the link I was referring got info that PJ.ProjectCenterSatellite does not exist in PS2013. Instead use the method projectCenterComponent.get_GridSatellite().GetJsGridControlInstance().GetSelectedRecordKeys(false) to retrieve selected project.

    /// <reference name="MicrosoftAjax.js"/>
    /// <reference path="~/_layouts/inc/pwa/library/shell.js"/>
    /// <reference path="~/_layouts/SP.Core.js"/>
    /// <reference path="~/_layouts/ps.core.js"/>
    /// <reference path="~/_layouts/ps.projectmanagers.js"/>
    /// <reference path="~/_layouts/JsGrid.js"/>
    /// <reference path="~/_layouts/JsGrid.Gantt.js"/>

    var Temp_PCE;             // Contains the Project Center extension object.

    _spBodyOnLoadFunctionNames.push("Temp_PCE_Main");

    function Temp_PCE_Main() {
       Temp_PCE = new Temp_GetPCE();
    }

    function Temp_GetPCE() {
        this.GetSelectedProject = function () {
            selection = projectCenterComponent.get_GridSatellite().GetJsGridControlInstance().GetSelectedRecordKeys(false);
            if (selection.length == 0) {
                alert('Please select a project.');
            }
            else if (selection.length > 1) {
                alert('Please select one project.');
            }
            else {
                return selection[0];
            }
            return null;
        }
    }

    Reference: http://www.datazx.cn/Forums/cs-CZ/5de09b6e-7dc6-4d8c-8134-95a97bf6f34f/action?threadDisplayName=accessing-the-js-grid-for-project-server-2013-preview&forum=project2010custprog

    Thanks,

    Pramila


    Tuesday, March 17, 2015 6:25 AM