/* input { { project:"A", role:"A", hours:21, date:today(), status:null } } */ =load( local!selectedIndices: tointeger({}), a!formLayout( label: "SAIL Example: Inline Editable Grid using Selection for Bulk Actions", firstColumnContents: { a!buttonArrayLayout(buttons: { a!buttonWidget( label: "Approve", value: "Approve", /* You can save into a field at many indices at a time */ saveInto: { ri!hours[local!selectedIndices].status, /* Clear the selected indices after a decision is made */ a!save(local!selectedIndices, tointeger({})) }, disabled: count(local!selectedIndices) = 0 ), a!buttonWidget( label: "Reject", value: "Reject", saveInto: { ri!hours[local!selectedIndices].status, /* Clear the selected indices after a decision is made */ a!save(local!selectedIndices, tointeger({})) }, disabled: count(local!selectedIndices) = 0 ) }), a!gridLayout( headerCells: { a!gridLayoutHeaderCell(label: "Project"), a!gridLayoutHeaderCell(label: "Role", align: "RIGHT"), a!gridLayoutHeaderCell(label: "Date", align: "RIGHT"), a!gridLayoutHeaderCell(label: "Hours", align: "RIGHT"), a!gridLayoutHeaderCell(label: "User", align: "RIGHT"), a!gridLayoutHeaderCell(label: "Due", align: "RIGHT") }, /* Only needed when some columns need to be narrow */ columnConfigs: { a!gridLayoutColumnConfig(width: "DISTRIBUTE"), a!gridLayoutColumnConfig(width: "DISTRIBUTE"), a!gridLayoutColumnConfig(width: "DISTRIBUTE"), a!gridLayoutColumnConfig(width: "DISTRIBUTE"), a!gridLayoutColumnConfig(width: "DISTRIBUTE"), a!gridLayoutColumnConfig(width: "DISTRIBUTE") }, rows: a!applyComponents( function: rule!PX_LI_EditableGridApprovalSupportingRule( hours: ri!hours, index: _ ), array: if(or(isnull(ri!hours), count(ri!hours) < 1), {}, 1+enumerate(count(ri!hours))) ), selectable: true, selectionValue: local!selectedIndices, selectionSaveInto: local!selectedIndices ), a!textField( label: "Selected Values", labelPosition: "ADJACENT", instructions: typename(typeof(local!selectedIndices)), value: local!selectedIndices, readOnly: true ) }, buttons: a!buttonLayout( primaryButtons: a!buttonWidgetSubmit( label: "Submit" ) ) ) )