how to delete a entire row in readonly grid?
Discussion posts and replies are publicly visible
For this, you can create an extra column in gridfield and in that create a icon and use dynamic link to remove the row from the variable and if you want to remove it from DB then use deletefromdatastoreentity as well along with remove function.
please check code once,please verify index position
a!gridColumn(
label: "",
value: a!richTextDisplayField(
value: a!richTextIcon(
icon:"trash-o",
link:a!dynamicLink(
value: 'type!{urn:com:appian:types:HR}hrcandidatedetails'(),
saveInto:a!save(ri!hrcandidatedetails,remove(ri!hrcandidatedetails,fv!row)),
)
),
Remove works with the index and not the item. You will have to use the identifier (if the data is not DB backed) and wherecontains() if the data is DB backed in the second parameter of the remove() function.
Expression evaluation error at function 'remove' [line 149]: Invalid index (3) for list: valid range is 1..1
please show me the code if possible for remove only
Do you only have one row in the grid?
I have multiple Rows, In that selected row to be deleted by using richTextIcon what we did in editable grid?
Try running this code in an unnamed interface to understand how removing works.
a!localVariables( local!data: { { first: "Some", second: "Value" }, { first: "Another", second: "Point" } }, a!gridField( data: local!data, columns: { a!gridColumn( label: "First Column", value: fv!row.first ), a!gridColumn( label: "Second Column", value: fv!row.second ), a!gridColumn( value: a!richTextDisplayField( value: a!richTextIcon( icon: "times", link: a!dynamicLink( value: remove( local!data, wherecontains( fv!row, cast(typeof({ a!map() }), local!data) ) ), saveInto: local!data ) ) ) ) } ) )
yea its working perfectly thanks Harshit Bumb bro
here its good delete by using time function,but I want to remove it from DB then use deletefromdatastoreentity as well along with remove function? I am using but not delete in DB Level ? how we do? If possible please send a code?
to delete from DB you have to use it's identifier which is a primary key.
a!richTextIcon( icon: "times", color: "NEGATIVE", link: a!dynamicLink( saveInto: { a!deleteFromDataStoreEntities( dataToDelete: { a!entityDataIdentifiers( entity: cons!CDU_CAR_ITEM_DETAILS, identifiers: fv!item.id /*Your primary key value by using fv!identifier in case of gridfield and fv!item.{primarykeyname} in case of gridLayout*/ ) } ), a!save( ri!itemDetails, /*actual array from where we have to remove*/ remove( ri!itemDetails, fv!index ) ) } ) )