Hello Community,
I want to make an editable grid with fields having below details
Column Names - studentCountry , studentName, subject , status - (Pass or Fail)I've Created the grid where the studentName will be repeating and read only because of the different subjects & also subject will be read only-> the user (teacher) should fill the studentCountry and his status - (Pass or Fail) in editable grid,Now my requirement is such that when a teacher selects student country for a particular student it should update the studentCountry for all the rows having that particular student name.How should I achieve this. Any suggestion will helpful.Some sample data for better understanding studentCountry studentName subject status1) dropdown Student A Maths Yes/No (radio button)2) dropdown Student A Science Yes/No (radio button) 3) dropdown Student A English Yes/No (radio button)
4) dropdown Student B Maths Yes/No (radio button)5) dropdown Student B Science Yes/No (radio button) 6) dropdown Student B English Yes/No (radio button)
Thanks in advance.
Discussion posts and replies are publicly visible
load( local!student: { { id: 1, name: "Kelly", country: null }, { id: 2, name: "Jason", country: null }, { id: 3, name: "David", country: null } }, local!subject: { { subId: 1, studentId: 1, subject: "English", status: "" }, { subId: 2, studentId: 1, subject: "Science", status: "" }, { subId: 3, studentId: 1, subject: "Maths", status: "" }, { subId: 4, studentId: 2, subject: "English", status: "" }, { subId: 5, studentId: 2, subject: "Science", status: "" }, { subId: 6, studentId: 2, subject: "Maths", status: "" }, { subId: 4, studentId: 3, subject: "English", status: "" }, { subId: 5, studentId: 3, subject: "Science", status: "" }, { subId: 6, studentId: 3, subject: "Maths", status: "" } }, a!formLayout( contents: { a!gridLayout( headerCells: { a!gridLayoutHeaderCell(label: "Student"), a!gridLayoutHeaderCell(label: "Country"), a!gridLayoutHeaderCell(label: "Subject"), a!gridLayoutHeaderCell(label: "Status"),
}, columnConfigs: { a!gridLayoutColumnConfig(width: "DISTRIBUTE"), a!gridLayoutColumnConfig(width: "DISTRIBUTE"), a!gridLayoutColumnConfig(width: "DISTRIBUTE"), a!gridLayoutColumnConfig(width: "DISTRIBUTE") }, rows: a!forEach( items: local!subject, expression: a!localVariables( local!studentIndex: tointeger( wherecontains(fv!item.studentId, local!student.id) )[1], a!gridRowLayout( id: fv!index, contents: { a!textField( readOnly: true, value: local!student[wherecontains(fv!item.studentId, local!student.id)].name ), a!dropdownField( choiceLabels: { "country 1", "Country 2" }, choiceValues: { "country 1", "Country 2" }, placeholder: "Select Country", value: tostring( local!student[local!studentIndex].country ), saveInto: { local!student[local!studentIndex].country } ), a!textField(readOnly: true, value: fv!item.subject), a!dropdownField( choiceLabels: { "Pass", "Fail" }, choiceValues: { "Pass", "Fail" }, placeholder: "Select Status", value: fv!item.status ) } ) ) ) ) } ))
Thank you jasmithak , Above code does exactly what I want, the only issue I am facing is how to save this data in rule input which I'll be passing in process model to update my tables.thanks again.
When implemented in a "real" task as opposed to an example that anyone can copy and paste, generally you would be acting directly upon the student data (i.e. via "ri!student"), rather than in a local variable. Sometimes it's necessary to do such processing on a local variable instead, and in those cases you can simply save the contents of the local variable back into the rule input when the user clicks the Submit button.
your requirement is update and country, status and write it back to DB?