Grid用户界面(UI)元素显示一组表格状的行。 行可以通过打开返回行数据的刀片来添加或编辑。
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定义了打开形成一行的锯刃。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.EditableGrid。Microsoft.Common.Grid