Grid使用者介面(UI)元素顯示一組表格式的列。 可透過開啟返回行資料的刀片來新增或編輯行數。
使用者介面範例
該 Grid 元素會渲染一個帶有指令按鈕的表格,用於新增、編輯和刪除列。
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定義了打開形成一行的刀刃。nameparametersoutputItem, 是必填條件。 -
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。