Microsoft。Common.Grid UI 元素

Grid使用者介面(UI)元素顯示一組表格式的列。 可透過開啟返回行資料的刀片來新增或編輯行數。

使用者介面範例

該 Grid 元素會渲染一個帶有指令按鈕的表格,用於新增、編輯和刪除列。

Microsoft 的截圖。Common.Grid UI 元素。

Schema

{
  "name": "subnets",
  "type": "Microsoft.Common.Grid",
  "label": {
    "summary": "Subnets",
    "addition": "Add subnet",
    "delete": "Delete subnet",
    "ariaLabel": "Subnets"
  },
  "defaultValue": [
    {
      "name": "default",
      "addressPrefix": "10.0.0.0/24"
    }
  ],
  "addBlade": {
    "name": "SubnetBlade",
    "extension": "Microsoft_Azure_Network",
    "parameters": {},
    "outputItem": "subnet",
    "inContextPane": true
  },
  "editBlade": {
    "name": "SubnetBlade",
    "extension": "Microsoft_Azure_Network",
    "parameters": {
      "subnet": "[$item]"
    },
    "outputItem": "subnet",
    "inContextPane": true
  },
  "constraints": {
    "rows": {
      "count": {
        "min": 1,
        "max": 5
      }
    },
    "canEditRows": true,
    "columns": [
      {
        "id": "name",
        "header": "Name",
        "cellType": "readonly",
        "text": "[$item.name]"
      },
      {
        "id": "addressPrefix",
        "header": "Address prefix",
        "cellType": "readonly",
        "text": "[$item.addressPrefix]"
      }
    ],
    "width": "Full"
  },
  "visible": true
}

範例輸出

[
  {
    "name": "default",
    "addressPrefix": "10.0.0.0/24"
  }
]

Remarks

  • label.summary 用於摘要和無障礙文本。
  • label.addition 並提供 label.delete 指令標籤。
  • defaultValue 是一組列物件的陣列,或是一個將 值數值為陣列的表達式。
  • addBlade 定義了打開形成一行的刀刃。 name parameters outputItem, 是必填條件。
  • editBlade 定義開啟的刀片以編輯現有列。 當 constraints.canEditRows 是 true時,這是必要的。
  • constraints.rows.count.min 並 constraints.rows.count.max 設定列數限制。
  • constraints.columns 定義表格欄位。 一 readonly 欄使用 text;一 input 欄使用 element。
  • constraints.width 可以是 Small、Medium 或 Full。
  • 對於公開的模板規格表單,除非你的主機支援由 Microsoft.Common.Grid引用的新增與編輯刀片,否則請使用 Microsoft.Common.EditableGrid 。

下一步