Editable Grid

 ,

May I know How to create fringe benefits grid( from the above picture)?

I tried like below..,for percentage & Amount column, If I insert a value for one row , same value is being reflected in all the newly added rows, I want to add desired value for each row under percentage & Amount columns..,

a!sectionLayout(
label: "Fringe Benefits",
contents: {
a!gridLayout(
label: " ",
labelPosition: "COLLAPSED",
headerCells: {
a!gridLayoutHeaderCell(label: "Fringe Benefits "),
a!gridLayoutHeaderCell(label: "Percentage"),
a!gridLayoutHeaderCell(label: "Amount")
},
columnConfigs: {
a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
a!gridLayoutColumnConfig(width: "DISTRIBUTE")
},
rows: {
a!gridRowLayout(
contents: {
a!textField(
disabled: true(),
label: "F.I.C.A",
value: index(local!FringeBenefit,1,{})


),
a!textField(
label: "Percentage",
value: ri!gai_ref_fringe_benefit_type['recordType!{ee33b698-41fb-447f-90a2-c57b7ae42295}GAI Ref Fringe Benefit Type.relationships.{cfd37672-625d-450f-851d-0e1cf2a67726}gaiBudgetPersonnelBenefit.fields.{9e8e9dfc-941b-4099-ba98-094707466911}percentage']&" "&" %",
saveInto: ri!gai_ref_fringe_benefit_type['recordType!{ee33b698-41fb-447f-90a2-c57b7ae42295}GAI Ref Fringe Benefit Type.relationships.{cfd37672-625d-450f-851d-0e1cf2a67726}gaiBudgetPersonnelBenefit.fields.{9e8e9dfc-941b-4099-ba98-094707466911}percentage'],
align: "RIGHT"
),
a!integerField(
label: "Amount",
value: ri!gai_ref_fringe_benefit_type['recordType!{ee33b698-41fb-447f-90a2-c57b7ae42295}GAI Ref Fringe Benefit Type.relationships.{cfd37672-625d-450f-851d-0e1cf2a67726}gaiBudgetPersonnelBenefit.fields.{ca5f96cc-cea6-4616-b874-e51cb3832926}amount'],
saveInto: ri!gai_ref_fringe_benefit_type['recordType!{ee33b698-41fb-447f-90a2-c57b7ae42295}GAI Ref Fringe Benefit Type.relationships.{cfd37672-625d-450f-851d-0e1cf2a67726}gaiBudgetPersonnelBenefit.fields.{ca5f96cc-cea6-4616-b874-e51cb3832926}amount']
)
}
),
a!gridRowLayout(
contents: {
a!textField(
disabled: true(),
label: "Retirement",
value:index(local!FringeBenefit,2,{})


),
a!textField(
label: "Percentage",
value: ri!gai_ref_fringe_benefit_type['recordType!{ee33b698-41fb-447f-90a2-c57b7ae42295}GAI Ref Fringe Benefit Type.relationships.{cfd37672-625d-450f-851d-0e1cf2a67726}gaiBudgetPersonnelBenefit.fields.{9e8e9dfc-941b-4099-ba98-094707466911}percentage']&" "&" %",
saveInto: ri!gai_ref_fringe_benefit_type['recordType!{ee33b698-41fb-447f-90a2-c57b7ae42295}GAI Ref Fringe Benefit Type.relationships.{cfd37672-625d-450f-851d-0e1cf2a67726}gaiBudgetPersonnelBenefit.fields.{9e8e9dfc-941b-4099-ba98-094707466911}percentage'],
align: "RIGHT"
),
a!integerField(
label: "Amount",
value: ri!gai_ref_fringe_benefit_type['recordType!{ee33b698-41fb-447f-90a2-c57b7ae42295}GAI Ref Fringe Benefit Type.relationships.{cfd37672-625d-450f-851d-0e1cf2a67726}gaiBudgetPersonnelBenefit.fields.{ca5f96cc-cea6-4616-b874-e51cb3832926}amount'],
saveInto: ri!gai_ref_fringe_benefit_type['recordType!{ee33b698-41fb-447f-90a2-c57b7ae42295}GAI Ref Fringe Benefit Type.relationships.{cfd37672-625d-450f-851d-0e1cf2a67726}gaiBudgetPersonnelBenefit.fields.{ca5f96cc-cea6-4616-b874-e51cb3832926}amount']
)
}
),
a!gridRowLayout(
contents: {
a!textField(
disabled: true(),
label: "Health Insurence",
value: index(local!FringeBenefit,3,{})


),
a!textField(
label: "Percentage",
value: ri!gai_ref_fringe_benefit_type['recordType!{ee33b698-41fb-447f-90a2-c57b7ae42295}GAI Ref Fringe Benefit Type.relationships.{cfd37672-625d-450f-851d-0e1cf2a67726}gaiBudgetPersonnelBenefit.fields.{9e8e9dfc-941b-4099-ba98-094707466911}percentage']&" "&" %",
saveInto: ri!gai_ref_fringe_benefit_type['recordType!{ee33b698-41fb-447f-90a2-c57b7ae42295}GAI Ref Fringe Benefit Type.relationships.{cfd37672-625d-450f-851d-0e1cf2a67726}gaiBudgetPersonnelBenefit.fields.{9e8e9dfc-941b-4099-ba98-094707466911}percentage'],
align: "RIGHT"
),
a!integerField(
label: "Amount",
value: ri!gai_ref_fringe_benefit_type['recordType!{ee33b698-41fb-447f-90a2-c57b7ae42295}GAI Ref Fringe Benefit Type.relationships.{cfd37672-625d-450f-851d-0e1cf2a67726}gaiBudgetPersonnelBenefit.fields.{ca5f96cc-cea6-4616-b874-e51cb3832926}amount'],
saveInto: ri!gai_ref_fringe_benefit_type['recordType!{ee33b698-41fb-447f-90a2-c57b7ae42295}GAI Ref Fringe Benefit Type.relationships.{cfd37672-625d-450f-851d-0e1cf2a67726}gaiBudgetPersonnelBenefit.fields.{ca5f96cc-cea6-4616-b874-e51cb3832926}amount']
)
}
),
a!gridRowLayout(
contents: {
a!textField(
disabled: true(),
label: "Workers Comp",
value: index(local!FringeBenefit,4,{})


),
a!textField(
label: "Percentage",
value: ri!gai_ref_fringe_benefit_type['recordType!{ee33b698-41fb-447f-90a2-c57b7ae42295}GAI Ref Fringe Benefit Type.relationships.{cfd37672-625d-450f-851d-0e1cf2a67726}gaiBudgetPersonnelBenefit.fields.{9e8e9dfc-941b-4099-ba98-094707466911}percentage']&" "&" %",
saveInto: ri!gai_ref_fringe_benefit_type['recordType!{ee33b698-41fb-447f-90a2-c57b7ae42295}GAI Ref Fringe Benefit Type.relationships.{cfd37672-625d-450f-851d-0e1cf2a67726}gaiBudgetPersonnelBenefit.fields.{9e8e9dfc-941b-4099-ba98-094707466911}percentage'],
align: "RIGHT"
),
a!integerField(
label: "Amount",
value: ri!gai_ref_fringe_benefit_type['recordType!{ee33b698-41fb-447f-90a2-c57b7ae42295}GAI Ref Fringe Benefit Type.relationships.{cfd37672-625d-450f-851d-0e1cf2a67726}gaiBudgetPersonnelBenefit.fields.{ca5f96cc-cea6-4616-b874-e51cb3832926}amount'],
saveInto: ri!gai_ref_fringe_benefit_type['recordType!{ee33b698-41fb-447f-90a2-c57b7ae42295}GAI Ref Fringe Benefit Type.relationships.{cfd37672-625d-450f-851d-0e1cf2a67726}gaiBudgetPersonnelBenefit.fields.{ca5f96cc-cea6-4616-b874-e51cb3832926}amount']
)
}
),

a!gridRowLayout(
contents: {
a!textField(
label: "Others",
value: index(local!FringeBenefit,6,{}),
disabled: true()


),
a!textField(
label: "Percentage",
value: ri!gai_ref_fringe_benefit_type['recordType!{ee33b698-41fb-447f-90a2-c57b7ae42295}GAI Ref Fringe Benefit Type.relationships.{cfd37672-625d-450f-851d-0e1cf2a67726}gaiBudgetPersonnelBenefit.fields.{9e8e9dfc-941b-4099-ba98-094707466911}percentage']&" "&" %",
saveInto: ri!gai_ref_fringe_benefit_type['recordType!{ee33b698-41fb-447f-90a2-c57b7ae42295}GAI Ref Fringe Benefit Type.relationships.{cfd37672-625d-450f-851d-0e1cf2a67726}gaiBudgetPersonnelBenefit.fields.{9e8e9dfc-941b-4099-ba98-094707466911}percentage'],
align: "RIGHT"
),
a!integerField(
label: "Amount",
value: ri!gai_ref_fringe_benefit_type['recordType!{ee33b698-41fb-447f-90a2-c57b7ae42295}GAI Ref Fringe Benefit Type.relationships.{cfd37672-625d-450f-851d-0e1cf2a67726}gaiBudgetPersonnelBenefit.fields.{ca5f96cc-cea6-4616-b874-e51cb3832926}amount'],
saveInto: ri!gai_ref_fringe_benefit_type['recordType!{ee33b698-41fb-447f-90a2-c57b7ae42295}GAI Ref Fringe Benefit Type.relationships.{cfd37672-625d-450f-851d-0e1cf2a67726}gaiBudgetPersonnelBenefit.fields.{ca5f96cc-cea6-4616-b874-e51cb3832926}amount']
)
}
),
a!forEach(
items: ri!gai_ref_fringe_benefit_type,
expression: a!gridRowLayout(
contents: {
a!textField(
label: "Others",
value: index(local!FringeBenefit,6 ,{}),
disabled: true(),

),
a!textField(
label: "Percentage",
value: ri!gai_ref_fringe_benefit_type['recordType!{ee33b698-41fb-447f-90a2-c57b7ae42295}GAI Ref Fringe Benefit Type.relationships.{cfd37672-625d-450f-851d-0e1cf2a67726}gaiBudgetPersonnelBenefit.fields.{9e8e9dfc-941b-4099-ba98-094707466911}percentage']&" "&" %",
saveInto: ri!gai_ref_fringe_benefit_type['recordType!{ee33b698-41fb-447f-90a2-c57b7ae42295}GAI Ref Fringe Benefit Type.relationships.{cfd37672-625d-450f-851d-0e1cf2a67726}gaiBudgetPersonnelBenefit.fields.{9e8e9dfc-941b-4099-ba98-094707466911}percentage'],
align: "RIGHT"
),
a!integerField(
label: "Amount",
value: ri!gai_ref_fringe_benefit_type['recordType!{ee33b698-41fb-447f-90a2-c57b7ae42295}GAI Ref Fringe Benefit Type.relationships.{cfd37672-625d-450f-851d-0e1cf2a67726}gaiBudgetPersonnelBenefit.fields.{ca5f96cc-cea6-4616-b874-e51cb3832926}amount'],
saveInto: ri!gai_ref_fringe_benefit_type['recordType!{ee33b698-41fb-447f-90a2-c57b7ae42295}GAI Ref Fringe Benefit Type.relationships.{cfd37672-625d-450f-851d-0e1cf2a67726}gaiBudgetPersonnelBenefit.fields.{ca5f96cc-cea6-4616-b874-e51cb3832926}amount']
)
}
)
)


},
selectionSaveInto: {},
addRowLink: a!dynamicLink(
label: "Addnew",
value: {
'recordType!{ee33b698-41fb-447f-90a2-c57b7ae42295}GAI Ref Fringe Benefit Type'(
'recordType!{ee33b698-41fb-447f-90a2-c57b7ae42295}GAI Ref Fringe Benefit Type.fields.{2bc7aa63-024e-413f-b9c2-b708888b6132}createTs':now(),
'recordType!{ee33b698-41fb-447f-90a2-c57b7ae42295}GAI Ref Fringe Benefit Type.fields.{bb49b405-4d30-4e44-a6a5-8e159b0f19db}createUsr':loggedInUser(),
'recordType!{ee33b698-41fb-447f-90a2-c57b7ae42295}GAI Ref Fringe Benefit Type.fields.{108fe0b5-12fb-4980-8da1-1c0fbe10e030}isActive':true()
)
},
saveInto: {a!save(ri!gai_ref_fringe_benefit_type,
append(ri!gai_ref_fringe_benefit_type,save!value))}
),

validations: {},
shadeAlternateRows: true,
spacing: "DENSE"
),

}
)

  Discussion posts and replies are publicly visible

Parents
  • Please put this code in a code box.

    What I can understand from the current state is, it is happening because you have formed a loop in gridRowLayout() on ri!gai_ref_fringe_benefit_type but for Percentage and Amount field you are not referencing the record field using fv!item and instead using the ri! that's why it is showing previous row values for newly appended row. Replace ri!gai_ref_fringe_benefit_type with fv!item and it should work.

Reply
  • Please put this code in a code box.

    What I can understand from the current state is, it is happening because you have formed a loop in gridRowLayout() on ri!gai_ref_fringe_benefit_type but for Percentage and Amount field you are not referencing the record field using fv!item and instead using the ri! that's why it is showing previous row values for newly appended row. Replace ri!gai_ref_fringe_benefit_type with fv!item and it should work.

Children
No Data