Hello Everyone,
I am working on a!gridField and need to select the rows which are of same status and other rows should be disabled(Non selectable).
For Example : If I select any row with status :"Inprogress" then only inprogress rows should be selectable where other rows should be in disbaled.Later similarly if I select a row with Draft status then only draft status records should be selectable and other should be disabled.
Please help me if anyone have worked this kind of requirement.
Thanks in advance.
Discussion posts and replies are publicly visible
Have a look at the parameter "disableRowSelectionWhen"
docs.appian.com/.../Paging_Grid_Component.html
I have tried on this parameter but could not able achieve could you please help me with sample code
The way I have tried :
disableRowSelectionWhen : if( a!isNullOrEmpty(local!selected), {}, index(local!selectedRows, "workflowStatus", {}) <> index(fv!row, "workflowStatus", {}) )
For suppose I have 7 rows with 2 drafts status & 3 completed status,2 Review status.Now if I select one draft status remaining 5 of other status getting disabled and after I select the 2 draft status row then the entire grid rows were getting disabled with two draft status selected.Is there any way to stop after selecting all the available draft status rows.
The compare operator does not make much sense. Comparing a list to a single value returns a list of true/false values which you then feed into that parameter.
I understand your explanation a bit different. As soon as a single row is selected, only rows with the same status should stay selectable. If this is the case, I think working code might look like this:
contains(index(local!selectedRows, "workflowStatus", {}), index(fv!row, "workflowStatus", {}))
Hey hemap0003 , as Stefan suggested since it is a list you can use contains or index the first selected row.Try this.
a!localVariables( local!selectedRows, local!workflowStatus: { { workflowStatus: "Draft" }, { workflowStatus: "Draft" }, { workflowStatus: "Completed" }, { workflowStatus: "Completed" }, { workflowStatus: "Completed" }, { workflowStatus: "Review" }, { workflowStatus: "Review" }, { workflowStatus: "Review" } }, { a!gridField( selectable: true, data: local!workflowStatus, selectionValue: local!selectedRows, selectionSaveInto: { local!selectedRows, /* if the user clicked on all select checkbox, we can't hide this but you can add custom checkbox field in place of grid field checkbox if it is somewhat not performant */ a!save( local!selectedRows, a!forEach( items: local!selectedRows, expression: if( a!isNullOrEmpty(local!selectedRows), {}, if( index( index( index( local!workflowStatus, local!selectedRows, {} ), "workflowStatus", {} ), 1, {} ) <> index( index(local!workflowStatus, fv!item, {}), "workflowStatus", {} ), {}, fv!item ) ) ) ) }, disableRowSelectionWhen: if( a!isNullOrEmpty(local!selectedRows), {}, index( index( index( local!workflowStatus, local!selectedRows, {} ), "workflowStatus", {} ), 1, {} ) <> index(fv!row, "workflowStatus", {}) ), columns: { a!gridColumn( label: "Status", value: fv!row.workflowStatus ) } ) } )
deepakrana7 Thanks for your time & response Deepak but I need to verify for group statuses instead of each status.{Draft,Draft Rework,Draft Approved} into one group and if I select any the rows with these status should be able to select where the other group status : {Metadata Review,Metadata Rework,Complete,Cancelled} should be disbaled.I have tried by passing the values into seperate expression rule which contains foreach function but this throwing an error stating refresh variable required.
Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function a!gridField [line 341]: Expression evaluation error at function a!forEach [line 402]: The load() function cannot be used within rules called by looping functions other than a!forEach(). Pass the necessary variables via rule inputs or use a!forEach().