Hi,
I am adding a button in Approval Center Page. i want to show the GUID of the Selected Assignment inside a popup. somethis like the http://msdn.microsoft.com/en-us/library/office/ff535984(v=office.14).aspx#pj14_CustomizeProjectCenter_Testing instead of project center i want inside approval center.
Following is my code, but unfortunately i am not able to fire the event on button click:
/// <reference name="MicrosoftAjax.js"/> /// <reference path="~/_layouts/inc/pwa/library/Utility.debug.js"/> /// <reference path="~/_layouts/inc/pwa/library/WebMethodManager.debug.js"/> /// <reference path="~/_layouts/inc/pwa/library/shell.debug.js"/> /// <reference path="~/_layouts/inc/pwa/library/TimesheetSatellite.js"/> /// <reference path="~/_layouts/inc/pwa/library/StatusApprovalsSatellite.js"/> /// <reference path="~/_layouts/inc/pwa/library/RemoteTextConv.debug.js"/> /// <reference path="~/_layouts/inc/pwa/library/ProjectFramework.debug.js"/> /// <reference path="~/_layouts/inc/pwa/library/GridSatellite.debug.js"/> /// <reference path="~/_layouts/inc/pwa/library/projectserverscripts.debug.js"/> /// <reference path="~/_layouts/inc/pwa/library/pagepropertymgr.debug.js"/> /// <reference path="~/_layouts/SP.core.debug.js"/> /// <reference path="~/_layouts/JsGrid.debug.js"/> /// <reference path="~/_layouts/JsGrid.Gantt.debug.js"/> var pc; // Contains the Project Center extension object. var toggleMode; // Maintains state of the toggle button. _spBodyOnLoadFunctionNames.push("ApprovalCenterMain"); function ApprovalCenterMain() { pc = new ApprovalCenterExtension(); //toggleMode = false; } function ApprovalCenterExtension() { var _grid; // Display surface (a view) of the JS Grid. var _satellite; // Control wrapper for the JS Grid. // Prevent ECMAScript errors if PJ or the AddGridSatellite function are not defined. // If the page is from Project Server, the PJ namespace is defined. // If the Project page includes JS Grid, the AddGridSatelliteInitializationNotifier // function is defined. if (window.PJ == null || PJ.AddGridSatelliteInitializationNotifier == null) { return; } // Use the PJ.AddGridSatelliteInitializationNotifier function to get an instance // of the satellite. PJ.AddGridSatelliteInitializationNotifier ( function (satellite) { if (PJ.ProjectCenterSatellite != null) { /*** Satellite override: Project code should pass in "satellite" instead of "this". ***/ satellite = PJ._NotifySatelliteInitComplete.arguments[0]; _satellite = satellite; /***End Satellite override***/ _grid = satellite.GetJsGridControlInstance(); _grid.AttachEvent(SP.JsGrid.EventType.OnRowFocusChanged, RowChanged); } } ); this.DisplaySelectedRecords = function () { var selection = _grid.GetSelectedRecordKeys(false); var url = "~/_layouts/CustomizeApprovalCenter/SelectedItems.aspx?ProjUIDS="; for (var i = 0; i < selection.length; i++) { url += selection[i] + "|"; } ShowSPDialog(url); } function ShowSPDialog(pageToLoad) { var options = { url: pageToLoad, title: 'GUIDs of Selected Tasks', showClose: true, width: 700, height: 250, allowMaximize: false, dialogReturnValueCallback: NotifyCallBack }; SP.UI.ModalDialog.showModalDialog(options); } // Show a notification when the modal dialog box is closed. function NotifyCallBack(dialogResult, returnValue) { SP.UI.Notify.addNotification('Successfully showed selected project GUIDs.'); } // Event handler for the OnRowFocusChanged event in the JS Grid. function RowChanged(eventArgs) { if (toggleMode) { var array = new Array(1); array[0] = eventArgs.newRecordKey; _satellite._tableCache.GetRecordsByKey(array, GridDataCallBack); } } // Callback function for the RowChanged event handler, which shows an alert dialog box // with the project name. function GridDataCallBack(arrayofKeys, arrayofRecords, bSucceeded) { alert(arrayofRecords[0].properties["PROJ_NAME"].GetLocalized()); } // this.ToggleMode = function () { // if (toggleMode) { // toggleMode = false; // } // else { // toggleMode = true; // } // } }
Thanks, Parth