=load( local!items: { {id: null, summary: "Item 1", qty: 1, unitPrice: 10, dept: "Sales", due: today() - 10}, {id: null, summary: "Item 2", qty: 2, unitPrice: 20, dept: "Finance", due: today() + 20}, {id: null, summary: "Item 3", qty: 3, unitPrice: 30, dept: "Sales", due: today() + 30} }, local!select:tointeger({}), local!selecttemp, local!itemsToken, a!formLayout( label: "SAIL Example: Inline Editable Grid", firstColumnContents: { a!gridLayout( headerCells: { a!gridLayoutHeaderCell(label: "Summary"), a!gridLayoutHeaderCell(label: "Qty", align: "RIGHT"), a!gridLayoutHeaderCell(label: "U/P", align: "RIGHT"), a!gridLayoutHeaderCell(label: "Amount", align: "RIGHT"), a!gridLayoutHeaderCell(label: "Department"), a!gridLayoutHeaderCell(label: "Due", align: "RIGHT") }, /* Only needed when some columns need to be narrow */ columnConfigs: { a!gridLayoutColumnConfig(width: "DISTRIBUTE"), a!gridLayoutColumnConfig(width: "NARROW"), a!gridLayoutColumnConfig(width: "NARROW"), a!gridLayoutColumnConfig(width: "DISTRIBUTE"), a!gridLayoutColumnConfig(width: "DISTRIBUTE"), a!gridLayoutColumnConfig(width: "DISTRIBUTE") }, rows: a!applyComponents( function: rule!testGridSelectionsubrule( items: local!items, index: _, itemsToken: local!itemsToken ), array: if(or(isnull(local!items), count(local!items) < 1), {}, 1+enumerate(count(local!items))), arrayVariable: local!itemsToken ), selectable: true, selectionValue:{tointeger({local!select})}, selectionSaveInto:{ a!save(local!selecttemp,"test"), a!save(local!select,if(length(tointeger(save!value))>0,union({save!value},tointeger({})),tointeger({}))) }, validations:if(length(tointeger(local!select))>1,"Select one Row only",{}) ), a!textField( label:"local!select", value:local!select ), a!textField( label:"length(tointeger(local!select))", value:length(tointeger(local!select)) ), a!textField( label:"(tointeger(local!select))", value:tointeger(local!select) ) }, buttons: a!buttonLayout( primaryButtons: a!buttonWidgetSubmit( label: "Submit" ) ) ) ) ----------------------- sub rule =a!gridRowLayout( contents: { a!textField( /* Labels are not visible in grid cells but are necessary to meet accessibility requirements */ label: "summary " & ri!index, value: ri!items[ri!index].summary, saveInto: ri!items[ri!index].summary, required: true ), a!integerField( label: "qty " & ri!index, value: ri!items[ri!index].qty, saveInto: ri!items[ri!index].qty, align: "RIGHT" ), a!floatingPointField( label: "unitPrice " & ri!index, value: ri!items[ri!index].unitPrice, saveInto: ri!items[ri!index].unitPrice, align: "RIGHT" ), a!textField( label: "amount " & ri!index, value: if( or(isnull(ri!items[ri!index].qty), isnull(ri!items[ri!index].unitPrice)), null, dollar(tointeger(ri!items[ri!index].qty) * todecimal(ri!items[ri!index].unitPrice)) ), readOnly: true, align: "RIGHT" ), a!dropdownField( label: "dept " & ri!index, choiceLabels: {"Finance", "Sales"}, placeholderLabel: "--Select-- ", choiceValues: {"Finance", "Sales"}, value: ri!items[ri!index].dept, saveInto: ri!items[ri!index].dept ), a!dateField( label: "due " & ri!index, value: ri!items[ri!index].due, saveInto: ri!items[ri!index].due, align: "RIGHT" ) }, id: ri!index )