PowerApps 中的資料表控制項Data table control in PowerApps

以表格格式顯示資料集。Shows a set of data in a tabular format.

說明Description

資料表控制項顯示資料集,是以包含該控制項顯示之每個欄位的資料行標頭的格式。The Data table control shows a dataset in a format that includes column headers for each field that the control shows. 身為應用程式製作者,您對於要顯示哪些欄位和順序有完整控制權。As an app maker, you have full control over which fields appear and in what order. 類似資源庫控制項,資料表控制項會維護指向已選取資料列的 Selected 屬性。Like the Gallery control, the Data table control maintains a Selected property that points to the selected row. 因此,您可以將資料表控制項連結到其他控制項。Therefore, you can link the Data table control to other controls.

容量Capabilities

PowerApps 在 2017 年 5 月 5 日導入資料表控制項。PowerApps introduced the Data table control on May 5, 2017. 本節提供支援及不支援功能的相關資訊。This section provides information about capabilities that are supported and capabilities that aren't supported.

現已推出Now available

  • 資料表控制項中的資料是唯讀的。Data in a Data table control is read-only.
  • 資料表控制項中一律會選取單一資料列。A single row is always selected in a Data table control.
  • 資料表控制項連結至已連線或本機資料來源。Link a Data table control to a connected or local data source.
  • 儘管您的變更不會儲存,依然在執行應用程式時在資料表控制項中調整資料行寬度。Adjust column widths in a Data table control while you run the app, though your changes aren't saved.
  • 當您將資料表控制項連結至已實作這項功能的連接器時 (例如 Common Data Service),會在該控制項中出現一組預設欄位。A set of default fields appear in a Data table control when you link it to a connector that has implemented this capability, such as the Common Data Service. 然後,您可以視需要顯示或隱藏這些欄位和其他欄位。You can then show or hide these fields and others as necessary.
  • 自訂資料行寬度和標題文字。Customize column width and heading text.
  • 顯示資料表控制項中的超連結。Show hyperlinks in a Data table control.
  • 複製並貼上資料表控制項。Copy and paste a Data table control.

無法使用Not yet available

  • 自訂個別資料行的樣式。Customize the styling of individual columns.
  • 在表單控制項中新增資料表控制項。Add a Data table control in a form control.
  • 變更所有資料列的高度。Change the height of all rows.
  • 顯示資料表控制項中的影像。Show images in a Data table control.
  • 顯示來自相關實體的欄位。Show fields from related entities.
  • 使用內建功能以依據資料行標題來篩選和排序資料。Use built-in functionality to filter and sort data by column heading.
  • 資源庫控制項中新增資料表控制項。Add a Data table control in a Gallery control.
  • 編輯資料表控制項中的資料。Edit data in the Data table control.
  • 選取多個資料列。Select multiple rows.

已知問題Known issues

  • 如果您在 Items 屬性中使用 FirstN 函式,則不會顯示資料。No data appears if you use the FirstN function in the Items property.

主要屬性Key properties

  • Items資料表控制項中顯示的資料來源。Items – The source of data that appears in the Data table control.
  • Selected資料表控制項中選取的資料列。Selected – The selected row in the Data table control.

其他屬性Other properties

  • BorderColor資料表控制項框線的色彩。BorderColor – The color of the Data table control's border.
  • BorderStyle資料表控制項框線的樣式。BorderStyle – The style of the Data table control's border. 選項有 SolidDashedDottedNoneThe options are Solid, Dashed, Dotted, and None.
  • BorderThickness資料表控制項框線的粗細。BorderThickness – The thickness of the Data table control's border.
  • Color – 所有資料列的預設文字色彩。Color – The default text color for all data rows.
  • Fill – 所有資料列的預設背景色彩。Fill – The default background color for all data rows.
  • Font – 所有資料列的預設字型。Font - The default font for all data rows.
  • FontWeight – 所有資料列的預設字型粗細。FontWeight – The default font weight for all data rows.
  • HeadingColor – 資料行標題的文字色彩。HeadingColor – The text color for the column headings.
  • HeadingFill – 資料行標題的背景色彩。HeadingFill – The background color of the column headings.
  • HeadingFont – 資料行標題的字型。HeadingFont – The font of the column headings.
  • HeadingFontWeight – 資料行標題的字型粗細。HeadingFontWeight – The font weight of the column headings.
  • HeadingSize – 資料行標題的字型大小。HeadingSize – The font size of the column headings.
  • Height資料表控制項的頂端和底部邊緣之間的距離。Height – The distance between the Data table control's top and bottom edges.
  • HoverColor – 滑鼠指標指向之資料列的文字色彩。HoverColor – The text color for the row that the mouse pointer is pointing at.
  • HoverFill – 滑鼠指標指向之資料列的背景色彩。HoverFill – The background color of the row that the mouse pointer is pointing at.
  • NoDataText資料表控制項沒有可顯示的記錄時,使用者收到的訊息。NoDataText – The message that the user receives when there are no records to show in the Data table control.
  • SelectedColor – 選取的資料列的文字色彩。SelectedColor – The color of the text in the selected row.
  • SelectedFill – 選取的資料列的背景色彩。SelectedFill – The background color of the selected row.
  • Size – 所有資料列的預設字型大小。Size – The default font size for all data rows.
  • Visible – 此值決定要顯示或隱藏資料表控制項。Visible – A value that determines whether the Data table control appears or is hidden.
  • Width資料表控制項左邊緣與右邊緣之間的距離。Width – The distance between the Data table control's left and right edges.
  • X資料表控制項左邊緣與其父容器左邊緣之間的距離 (沒有父容器時則為畫面左邊緣)。X – The distance between the left edge of the Data table control and the left edge of its parent container (or the left edge of the screen if there is no parent container).
  • Y資料表控制項頂端邊緣與其父容器頂端邊緣之間的距離 (沒有父容器時則為畫面頂端邊緣)。Y – The distance between the top edge of the Data table control and the top edge of its parent container (or the top edge of the screen if there is no parent container).

範例Examples

基本使用方式Basic usage

  1. 建立空白的平板電腦應用程式。Create a blank tablet app.
  2. 在 [插入] 索引標籤上,按一下或點選 [資料表]。On the Insert tab, click or tap Data table.

    在畫面中新增資料表控制項

    資料表控制項隨即新增至畫面。A Data table control is added to the screen.

  3. 資料表控制項重新命名為 SalesOrderTable,然後調整大小使其涵蓋整個畫面。Rename the Data table control SalesOrderTable, and resize it so that it covers the whole screen.
  4. 在右窗格中,按一下或點選 [未選取任何資料來源] 文字右側的向下箭頭,然後按一下或點選 [新增資料來源]。In the right pane, click or tap the down arrow to the right of the No data source selected text, and then click or tap Add a data source.

    新增資料來源

  5. 在連線清單中,按一下或點選 Common Data Service 資料庫的連線。In the list of connections, click or tap the connection for your Common Data Service database.

    選取資料來源的連線

  6. 在實體清單中,按一下或點選 [銷售單],然後按一下或點選 [連接]。In the list of entities, click or tap Sales order, and then click or tap Connect.

    選取銷售單實體

    資料表控制項現在已附加到銷售單資料來源。The Data table control is now attached to the Sales order data source. 數個初始欄位會出現在資料表控制項中,因為我們使用支援該功能的連接器。Several initial fields appear in the Data table control, because we're using a connector that supports that capability.

    資料表

  7. 在右窗格中,選取一或多個核取方塊,以顯示或隱藏個別的欄位。In the right pane, select one or more check boxes to show or hide individual fields.

    例如,選取 CustomerPurchaseOrderReference 旁的核取方塊,以隱藏此欄位。For example, select the check box next to CustomerPurchaseOrderReference to hide this field.

  8. 在右窗格中,向上或向下拖曳欄位,重新排列其順序。In the right pane, reorder the fields by dragging them up or down.

    視需要重新排列欄位

    SalesOrderTable 控制項會以您指定的順序顯示欄位。The SalesOrderTable control shows the fields in the order that you specified.

    更新後的資料表

重新設定資料表控制項之標頭的樣式Restyle the header for the Data table control

  1. 選取資料表控制項時,在右窗格中按一下或點選 [進階] 索引標籤。While the Data table control is selected, in the right pane, click or tap the Advanced tab.
  2. 按一下或點選欄位的 HeadingFill 屬性,然後將其值變更為 RGBA(62,96,170,1)Click or tap the field for the HeadingFill property, and then change the value to RGBA(62,96,170,1).
  3. 按一下或點選 HeadingColor 屬性的欄位,然後將其值變更為 WhiteClick or tap the field for the HeadingColor property, and then change the value to White.
  4. 按一下或點選欄位的 HeadingSize 屬性,然後將其值變更為 14Click or tap the field for the HeadingSize property, and then change the value to 14.

    資料表

將資料表控制項連線到另一個控制項Connect a Data table control to another control

  1. 在畫面中新增編輯表單控制項。Add an Edit form control to the screen.
  2. 調整資料表編輯表單控制項的大小,讓資料表控制項出現在畫面的左側部分、編輯表單控制項出現在畫面的右側部分。Resize the Data table and Edit form controls so that the Data table control appears in the left part of the screen and the Edit form control appears in the right part of the screen.

    資料表和編輯表單在同一畫面上

  3. 選取 Form1 時,在右窗格中將資料行數目變更為 1While Form1 is selected, in the right pane, change the number of columns to 1.
  4. Form1 連接至銷售單資料來源。Connect Form1 to the Sales order data source.

    數個初始欄位會出現在 Form1 中。Several initial fields appear in Form1.

    包含初始欄位的 Form1

  5. 在右窗格中,按一下或點選 [進階] 索引標籤。In the right pane, click or tap the Advanced tab.
  6. Form1Item 屬性設為 SalesOrderTable.SelectedSet the Item property for Form1 to SalesOrderTable.Selected.

    Form1 會顯示在資料表控制項中選取之資料列的資訊。Form1 shows information from the row that's selected in the Data table control.

    連線到資料表的編輯表單