Hi guys,
I am having a grid where a set of data will be on display. In a column I have used Icon indicator and a dynamic link. When I click it should change from true to false or false to true and the respective icon sholud change in the grid. Any solution for that. I have tried some ways but in the save option of dynamic link I am struck. Thanks in Advance.
Regards,
Kavya
Discussion posts and replies are publicly visible
Please post your code, at least the saveInto.
a!gridImageColumn( label: "Active?", field: "active", data: { a!forEach( items: index( local!data, "active", {} ), expression: if( fv!item = 1, a!documentImage( document: a!iconIndicator( icon: "STATUS_OK" ), caption: "Yes", link: a!dynamicLink( label: "change", value: if( fv!item = 1, false, true ), saveInto: a!save( ri!change, if( fv!item = 1, false, true ) ) ) ), a!documentImage( document: a!iconIndicator( icon: "STATUS_NOTDONE" ), caption: "No", link: a!dynamicLink( label: "change", value: if( fv!item = 1, false, true ), saveInto: a!save( ri!change, if( fv!item = 1, false, true ) ) ) ) ) ) }/*index(local!data,"active",{})*/ )
ri!change is a boolean variable I used for checking purpose. It was supposed to replace the value in local!data .
I assume ri!change is a multiple. Then you need to address that specific value in that list. Use the square bracket notation. And there is no need to compare a boolean to "1".
It might be necessary to pre-populate ri!change with as many items as you have in your grid.
value: not(ri!change[fv!index]), saveInto: ri!change[fv!index],
It was throwing error.
This is why I wrote "It might be necessary to pre-populate ri!change with as many items as you have in your grid."
Now it is saving the changed boolean values in ri!change. I have to save this ri!change to the local!data value ryt?
Also the values getting change in ri!change but not the icons.
Yes.
You might need to change the logic for the dynamic image a bit to work with the correct value.
there are several issue not quite fine:
a!gridImageColumn( label: "Active?", field: "active", data: { a!forEach( items: index( local!data, "active", {} ), expression: { a!documentImage( document: a!iconIndicator( icon: "STATUS_OK" ), caption: "Yes", link: a!dynamicLink( label: "change", saveInto: { a!save( target:local!data[fv!index].active, value: true ), /*bot sure if necerssary, depends on your construct*/ a!save( target:ri!change[fv!index], value: true ) } ), showWhen: toboolean(fv!item)=true ), a!documentImage( document: a!iconIndicator( icon: "STATUS_NOTDONE" ), caption: "No", link: a!dynamicLink( label: "change", saveInto: { a!save( target:local!data[fv!index].active, value: false ), /*bot sure if necerssary, depends on your construct*/ a!save( target:ri!change[fv!index], value: false ) } ), showWhen: toboolean(fv!item)=false ) } ) } )
Hi Kavya,
You can try an approach like this
If you need, you can also save into ri!change according to its structure / type
a!localVariables( local!paging: a!pagingInfo(1, 10), local!data: { { active: true() }, { active: false() } }, a!gridField_19r1( /*use a!gridField() if you are on 19.1 version*/ value: local!paging, totalCount: count(local!data), columns: { a!gridImageColumn( label: "Active?", field: "active", data: a!forEach( items: index(local!data, "active", {}), expression: a!localVariables( local!change: toboolean(fv!item), a!documentImage( document: a!iconIndicator( icon: if( local!change, "STATUS_OK", "STATUS_NOTDONE" ) ), caption: if(local!change, "Yes", "No"), link: a!dynamicLink( label: "change", value: not(local!change), saveInto: { local!change } ) ) ) ) ) } ) )