Pivoting Layers Oracle Fusion Middleware Online Documentation Library

Using ADF Pivot Table Components 26-7

26.6.2 How to Resize Rows, Columns, and Layers

The pivot table autosizes rows, columns, and layers when the pivot table is initially displayed. At runtime, you can change the size of rows, columns, or layers by dragging the row, column, or layer separator to a new location. To resize rows, columns, and layers at runtime: 1. If you want to resize a row, do the following: a. Position the cursor in the row header on the separator between the row you want to resize and the next row. b. When the cursor changes to a double-sided arrow, click and drag the row separator to the desired location. 2. If you want to resize a column, do the following: a. Position the cursor in the column header on the separator between the column you want to resize and the next column. b. When the cursor changes to a double-sided arrow, click and drag the column separator to the desired location. 3. If you want to resize a layer, do the following: a. Position the cursor in the row or column header on the separator between the layer you want to resize and the next layer. b. When the cursor changes to a double-sided arrow, click and drag the layer separator to the desired location.

26.6.3 What You May Need to Know About Resizing Rows, Columns, and Layers

When you resize rows, columns, or layers, the new sizes remain until you perform a pivot operation. After a pivot operation, the new sizes are cleared and the pivot table rows, columns, and layers return to their original sizes. If you do not perform a pivot operation, then the new sizes remain for the life of the session. However, you cannot save these sizes through MDS Metadata Services customization.

26.7 Updating Pivot Tables with Partial Page Rendering

You can update pivot tables, for example, to display the totals in a pivot table when triggered by a checkbox, by using partial page rendering PPR. PPR allows only certain components on a page to be rerendered without the need to refresh the entire page. For more information about PPR, see Chapter 7.1, Introduction to Partial Page Rendering. For a component to be rerendered based on an event caused by another component, it must declare which other components are the triggers. Use the partialTriggers attribute to provide a list of IDs of the components that should trigger a partial update of the pivot table. The pivot table listens on the trigger components and if one of the trigger components receives an event that will cause it to update in some way, the pivot table is also updated. Example 26–3 shows sample code for updating a pivot table by displaying the totals when a checkbox is triggered. The triggering component uses the ID as the partialTriggers value. 26-8 Web User Interface Developers Guide for Oracle Application Development Framework Example 26–3 Partial Update of a Pivot Table dvt:pivotTable id=goodPT value={richPivotTableModel.dataModel} partialTriggers=showTotals af:selectBooleanCheckbox id=showTotals autoSubmit=true label=Show Totals value={richPivotTableModel.totalsEnabled}

26.8 Exporting from a Pivot Table

You can export the data from a pivot table to a Microsoft Excel spreadsheet. Create an action source, such as a command button or command link, and add a dvt:exportPivotTableData component and associate it with the data you wish to export. You can configure the dvt:exportPivotTableData component so that the entire pivot table will be exported, or so that only the rows selected by the user will be exported. For example, Figure 26–11 shows a pivot table that includes command button components that allow users to export the data to an Excel spreadsheet. Figure 26–11 Pivot Table with Export to Excel Command Buttons When the user clicks the command button, by default all the rows and columns are exported in an Excel format written to the file specified in the filename attribute of the tag. Alternatively, you can configure the dvt:exportPivotTableData component so that only the rows the user selects are exported, by setting the exportedData attribute to selected. Example 26–4 shows the sample code for the Export to Excel command button. Example 26–4 Sample Code for Export to Excel Command Button af:commandButton text=Export To Excel immediate=true dvt:exportPivotTableData type=excelHTML exportedId=goodPT filename=updated_export.xls title=PivotTable export af:commandButton Figure 26–12 shows the resulting Excel spreadsheet. Using ADF Pivot Table Components 26-9 Figure 26–12 Pivot Table Export to Excel Spreadsheet

26.9 Customizing the Cell Content of a Pivot Table

All cells in a pivot table are either header cells or data cells. Before rendering a cell, the pivot table calls a method expression. You can customize the content of pivot table header cells and data cells by providing method expressions for the following attributes of the dvt:pivotTable tag: ■ For header cells, use one of the following attributes: – headerFormat: Use to create formatting rules to customize header cell content. – headerFormatManager: Use only if you want to provide custom state saving for the formatting rules of the application’s pivot table header cells. ■ For data cells, use one of the following attributes: – dataFormat: Use to create formatting rules to customize data cell content. – dataFormatManager: Use only if you want to provide custom state saving for the formatting rules of the application’s pivot table data cells.

26.9.1 How to Create a CellFormat Object for a Data Cell

To specify customization of the content of a data cell, you must code a method expression that returns an instance of oracle.dss.adf.view.faces.bi.component.pivotTable.CellFormat. To create an instance of a CellFormat object for a data cell: 1. Construct an oracle.adf.view.faces.bi.component.pivotTable.DataCellContext object for the data cells that you want to format. The DataCellContext method requires the following parameters in its constructor: – model: The name of the dataModel used by the pivot table. – row: An integer that specifies the zero-based row that contains the data cell on which you are operating. Note: You may receive a warning from Excel stating that the file is in a different format than specified by the file extension. This warning can be safely ignored.