Mashup Builder > 小器具 > 標準小器具 > 格點小器具 > 將頁尾區段新增至格點
將頁尾區段新增至格點
您可以啟用小器具 ShowFooter 內容或使用 JSON 組態資料,來將頁尾區段新增至格點。新增頁尾可讓您顯示摘要資訊,例如特定欄下的總值或平均值。若要在頁尾顯示標題欄名稱,請啟用 ShowHeaderRowInFooter 內容。
預先建構函數
您可以使用下列預先建構的函數顯示格點上每一欄的頁尾資料:
{#stat_count} - 計算列數。
{#stat_max} - 計算欄中值的最大用戶端值。
{#stat_min} - 計算欄中值的最小用戶端值。
{#stat_average} - 計算欄中值的平均用戶端值。
{#stat_total} - 計算欄中值的總用戶端值。
{#cspan} - 跨越欄,用於合併頁尾中的儲存格。合併儲存格時,您應該禁用欄重新排序。重新排序欄會影響頁尾的外觀。
* 
您也可以在資料服務中定義及使用自訂函數。
欲對齊頁尾中的資料,請使用 #cspantext-align:lefttext-align:right 對齊選項。在文字中新增逗號的 HTML 逸出字元,後跟對齊設定,預設設定為 text-align:left
為頁尾建立資料服務
欲配置頁尾,您必須繫結用於定義 FooterData 內容之組態規則的資料負載。以下範例服務用於定義包含格點頁尾資料的資料負載。
定義用於儲存資料負載輸出的變數。
var result = createInfoTable();
function createInfoTable() {
var params = {
infoTableName: undefined /* STRING */
};
定義資料負載之後,使用 AddField 方法來建立與格點資料中欄位名稱相符的欄。
var result = Resources["InfoTableFunctions"].CreateInfoTable(params);
//Add field to the InfoTable, ensure same field names in this footer data as are used in the actual table data:
result.AddField({name: "deviceName", baseType: "STRING"});
result.AddField({name: "motorTemp", baseType: "STRING"});
欲定義頁尾內容,請將資料新增至您之前建立的資料負載欄中。

result.AddRow({
'deviceName': 'Count: {#stat_count}', // Calculate the number of rows under the column.
'motorTemp': 'Average: {#stat_average}', // Calculate the average of all the values under the column.
});
return result;
}
下圖顯示繫結至格點小器具時的服務輸出:
這是否有幫助?