locked
How to Act on selected Task(s) in PWA 2010 Schedule Grid RRS feed

  • Question

  • I am looking for a way to launch some code (c#) when after one or more tasks in the PWA project schedule grid are selected and a ribbon button is clicked and have information from the task (e.g. name) passed to the code.  

    Does anyone have any suggestions?  I am new at this Project Server stuff...so be gentle.  Thanks. 

    Thursday, May 27, 2010 4:08 PM

Answers

  • Ah -- just saw Pat's reply in http://social.msdn.microsoft.com/Forums/en-US/project2010custprog/thread/0e8ebcdf-31ce-41a6-867c-2b4adc38737b.

    So, the following won't help, until you try what he suggests (which is unsupported -- so you won't see an example in the SDK).

    ____________________________________________________________

    In Procedure 2, step 5 of the aforementioned Walkthrough:

    "The GetSelectedRecordKeys function is defined in the JsGrid.debug.js file. In the JS Grid control on the Project Center page, the key of each project row is the project GUID."

    Have you used the same function to get the key of each task row selected in the grid on the Schedule.aspx page? I haven't used that particular page, but it seems likely the key is the task GUID. To verify, get one of the keys programmatically, and then compare with the task GUID that you get by using the Project.ReadProjectEntities method.

    Once you have the task GUIDs, Procedure 3, step 5 in the Walkthrough shows how to use the GUID array with the PSI.

    Friday, May 28, 2010 8:49 PM

All replies

  • Maybe it's not so gentle, but there is an article in the SDK that shows how to do a very similar job to what you want:

    Walkthrough: Customizing the PWA Ribbon and Accessing the JS Grid

    --Jim

    • Marked as answer by Jim Corbin Friday, May 28, 2010 7:21 PM
    • Unmarked as answer by Hill57 Friday, May 28, 2010 7:29 PM
    Friday, May 28, 2010 7:15 PM
  • Jim,

    Thanks for the response.  Unfortunately the ProjectCenter grid (in the SDK sample code) is different than the schedule grid.  The schedule grid is much harder to access.  

    I can get the row number(s) selected in the table, but have not yet figured out how to get the data in the row(s) selected or a TaskID for the task(s) selected in the schedule.  I have been pouring over the jsgrid.debug.js code for days...with trial and error I might eventually figure it out before Project Server 2525 comes out. :-)

    Friday, May 28, 2010 7:33 PM
  • Ah -- just saw Pat's reply in http://social.msdn.microsoft.com/Forums/en-US/project2010custprog/thread/0e8ebcdf-31ce-41a6-867c-2b4adc38737b.

    So, the following won't help, until you try what he suggests (which is unsupported -- so you won't see an example in the SDK).

    ____________________________________________________________

    In Procedure 2, step 5 of the aforementioned Walkthrough:

    "The GetSelectedRecordKeys function is defined in the JsGrid.debug.js file. In the JS Grid control on the Project Center page, the key of each project row is the project GUID."

    Have you used the same function to get the key of each task row selected in the grid on the Schedule.aspx page? I haven't used that particular page, but it seems likely the key is the task GUID. To verify, get one of the keys programmatically, and then compare with the task GUID that you get by using the Project.ReadProjectEntities method.

    Once you have the task GUIDs, Procedure 3, step 5 in the Walkthrough shows how to use the GUID array with the PSI.

    Friday, May 28, 2010 8:49 PM
  • Tom, Thanks for the reply. I did try GetSelectedRecords on the schedule grid and it does not return the TaskGuid, but it returns the row number (E.g. Row 4) of the selected row in the grid. Now if only I could find an array of the row data I could probably get the TaskGuid using the row number. Alas I haven't figured that out yet. Thanks.
    Friday, May 28, 2010 10:52 PM