Share via


Understanding Microsoft Office Project Web Access Grid Controls

Summary

Microsoft® Office Project Web Access 2003 controls can be customized for use with another data source, such as a Microsoft Office Access® database (*.mdb). By using Project Web Access ActiveX® controls, you can develop custom solutions for use in your own applications, or for use in a digital dashboard.

This article explains how to bind a data source different from the Project Server database to the grid/Gantt control (PjGrid.ocx) for use in an HTML file, and it describes the properties, methods, and events in PjGrid.ocx.

Download   Download the Microsoft Office Project Web Access Grid Control Sample from the Microsoft Office Project 2003 SDK (pj11SDK2003.exe) available from the Microsoft Download Center. The file contains all of the topics and source code samples for the Microsoft Office Project 2003 SDK, including the Project Web Access Grid Control sample (GridControl.exe).

Microsoft Office Project Web Access Controls

The following table identifies and describes the ActiveX controls for Project Web Access. All of the following controls are installed by default with Microsoft Office Project Server 2003.

Control

Description

PjOutlook.ocx

Pulls task and calendar entries from Microsoft Office Outlook® and converts them into ActiveX Data Objects (ADO) recordsets that the grid can interpret. This control warns the user before it reads data from Outlook, so it can't be used to access Outlook information without the user being aware.

Note  PjOutlook.ocx is marked as unsafe for scripting.

PjOffline.ocx

Caches pages for offline use when users switch to offline mode.

PjQuery.ocx

Acts as a general-purpose control for all miscellaneous client utility functions.

PjSecurity.ocx

Handles Project Web Access security.

PjUpdate.ocx

Updates tasks and calendar entries from Project Web Access into Microsoft Office Project.

PjCalendar.ocx

Provides a drop-down calendar for picking dates.

PjGrid.ocx

Displays task details, the timesheet, and the Gantt Chart.

PjTextConv.dll

Converts raw numeric data into strings, and strings into raw numeric data.

PjRes10c.dll

Loads strings and bitmaps from the resource DLLs.

Pj10ENUc.dll

Contains the English strings and bitmaps used by the grid and the text converter. There are separate DLLs for other languages.

Customizing Project Web Access Controls using PjGrid.ocx

You can use PjGrid.ocx to customize the Project Web Access controls to do the following:

  • Add functionality to Project Web Access pages    Display cost data with PjGrid.ocx. You can create a new page within Project Web Access to display this information, or you can add it to an existing page in Project Web Access.
  • Display Outlook tasks in a graphical format in the Gantt control    Use the object model to save Outlook tasks to a text file and then display them in Project Web Access.
  • Present ActiveX controls in a digital dashboard    Present PjGrid.ocx in a digital dashboard. The Microsoft Office SharePoint™ Portal Server 2003 Resource Kit (Chapter 4 - Introducing the Dashboard Site) provides information about the exposed properties and methods of the controls.

The following sections describe how to download the example files, alter the Microsoft JScript® code in Sample.htm to control the way data is displayed in the grid, and access the database through a virtual server.

Downloading the Example Files

The Project Web Access grid control sample includes four files that, together, show how you can bind PjGrid.ocx to data other than the Project Server database. The Sample.htm file displays contents in the same way as Project Web Access.

The files contained in the download are:

  • Sample.htm    The script file that displays the grid control that connects to the database.

  • Zoomout.gif, Goto.gif, and Zoomin.gif    Image files used in Sample.htm.

Copy the files to a Web-shared folder (for example, C:\inetpub\wwwroot) or to any physical folder on your Project Server computer. If you copy the files to a physical folder, create a virtual root (vroot) in the Internet Services Manager in Microsoft Internet Information Services (IIS).

Customizing Sample.htm

You can change the way information is displayed in this HTML page by editing the JScript code in Sample.htm.

The Initfunction in Sample.htm is the location where the display properties are set.

Note   The MSPJGrid.FieldList command is separated into several lines for display purposes only.

As it is configured above, the Init function displays a two-pane view: the left pane displays the Task Name, Start, Finish, Work, and Remaining Work fields; the right pane displays the Gantt bars.

The following table describes each action performed by the Init function:

Action

Description

rs.Fields.Append

Adds information to the grid from the recordset retrieved through ADO so that the grid can display data.

var fieldnames and var fieldvalues

Sets the array for displaying field names and field values.

MSPJGrid.Binding

Binds the recordset to the grid control.

MSPJGrid.FieldList = 
"#TASK_NAME[Project Name]<31>,
ASSN_START_DATE[Start],
ASSN_FINISH_DATE[Finish],
WASSN_PCT_COMP[Percent Complete],
ASSN_WORK[Work],
+ASSN_REM_WORK[Rem Work]";

Note  The MSPJGrid.FieldList command is separated into several lines for display purposes only.

Identifies which fields to display in the grid and how to display the columns of the recordset. See the grid FieldList property for more details about naming conventions.

MSPJGrid.Outlining

Gets or sets whether the rows in the grid have outlining applied or not. To facilitate outlining, there must be rows marked as summary rows and each sub-row must have a parent ID.

MSPJGrid.GanttView

Enables the Gantt view.

MSPJGrid.Refresh();

Refreshes the grid with all of the options set earlier.

Setting up the display data

The following table describes the fields defined in the sample.

Field name

Description

WASSN_ID

The unique ID for the assignment.

TASK_NAME

The name of the task.

ASSN_START_DATE

The start date for an assignment.

ASSN_FINISH_DATE

The finish date for an assignment.

ASSN_WORK

The total amount of work for an assignment.

ASSN_REM_WORK

The total amount of remaining work for an assignment.

Displaying Field List Details

The documentation of the FieldList property provides examples of syntax used to define fields in the grid.

SDK documentation

See also the PjGrid.ocx API Reference.

Important Licensing Information

The use of any Project Web Access components, including ActiveX controls and Active Server Pages, requires a Microsoft Office Project Web Access client license for each user. The Office Microsoft Project Web Access End-User License Agreement (EULA) contains the specific rights and restrictions, and can be viewed during setup of Project Server (or at http://servername/ProjectServer/download/dleula.asp after Project Server is installed). Project Web Access licenses can be obtained at authorized value-added resellers (VARs) and distributors, and directly from Microsoft. Licenses are not available through retail channels.