Im trying to move a row of data through the table, I got the down movement right but the up movement doesn't seem to work, it moves two row up instead of just one and doesn't update the previous position value to the new one, here's the code (relevant from line 39 downwards):
a!localVariables( local!properties:rule!MM_getPropertiesByType(type: ri!propertyType), { a!gridLayout( label: ri!propertiesLiteral, labelPosition: "ABOVE", headerCells: { a!gridLayoutHeaderCell(label: ""), a!gridLayoutHeaderCell(label: "Value"), a!gridLayoutHeaderCell(label: ""), a!gridLayoutHeaderCell(label: "") }, columnConfigs: { a!gridLayoutColumnConfig( width: "ICON" ), a!gridLayoutColumnConfig( weight: 10 ), a!gridLayoutColumnConfig( width: "ICON" ), a!gridLayoutColumnConfig( width: "ICON" ) }, rows: { a!forEach( items: local!properties, expression: a!gridRowLayout( contents: { a!richTextDisplayField( labelPosition: "COLLAPSED", value: { if( fv!index=1, {}, a!richTextIcon( icon: "arrow-up", link: a!dynamicLink( saveInto: { a!save( local!properties, insert( local!properties, fv!item, fv!index-1 ) ), a!save( local!properties, remove( local!properties fv!index+1 ) ) } ) ) ), if( fv!isLast, {}, a!richTextIcon( icon: "arrow-down", link: a!dynamicLink( saveInto: { a!save( local!properties, insert( local!properties, fv!item, fv!index+2 ) ), a!save( local!properties, remove( local!properties, fv!index ) ) } ) ) ) } ), a!textField( value: fv!item['recordType!{5ebb976a-556f-4033-b1d7-9e5976ab963d}MM Property.fields.{041a7f43-dfd1-4b07-aaed-48e305712f4e}value'], saveInto:{ fv!item['recordType!{5ebb976a-556f-4033-b1d7-9e5976ab963d}MM Property.fields.{041a7f43-dfd1-4b07-aaed-48e305712f4e}value'], a!save( fv!item['recordType!{5ebb976a-556f-4033-b1d7-9e5976ab963d}MM Property.fields.{2612aa2c-ca09-4a4f-87a1-f66b6f08303c}modifiedOn'], now() ) } ), a!richTextDisplayField( labelPosition: "COLLAPSED", value: { a!richTextIcon( icon: "dot-circle-large", color: if( fv!item['recordType!{5ebb976a-556f-4033-b1d7-9e5976ab963d}MM Property.fields.{18bf5c84-4f3f-4566-a572-6d8ba5dd5285}active'], "POSITIVE", "NEGATIVE" ), link: a!dynamicLink( saveInto: { a!save( fv!item['recordType!{5ebb976a-556f-4033-b1d7-9e5976ab963d}MM Property.fields.{18bf5c84-4f3f-4566-a572-6d8ba5dd5285}active'], if(fv!item['recordType!{5ebb976a-556f-4033-b1d7-9e5976ab963d}MM Property.fields.{18bf5c84-4f3f-4566-a572-6d8ba5dd5285}active'],false,true) ) } ) ) } ), a!richTextDisplayField( labelPosition: "COLLAPSED", value: { a!richTextIcon( icon: "times", color: "NEGATIVE", link: a!dynamicLink( saveInto: { a!save( local!properties, remove(local!properties,fv!index) ) } ) ) } ) } ) ) }, shadeAlternateRows: true, addRowLink:a!dynamicLink( label: "Add", saveInto: { a!save( local!properties, append(local!properties,'recordType!{5ebb976a-556f-4033-b1d7-9e5976ab963d}MM Property'( 'recordType!{5ebb976a-556f-4033-b1d7-9e5976ab963d}MM Property.fields.{54637987-ef12-4057-b4c3-c898561cb626}type': ri!propertyType, 'recordType!{5ebb976a-556f-4033-b1d7-9e5976ab963d}MM Property.fields.{832f6a1b-9643-4fd5-a389-0556c2ee74a6}order': count(local!properties)+1, 'recordType!{5ebb976a-556f-4033-b1d7-9e5976ab963d}MM Property.fields.{18bf5c84-4f3f-4566-a572-6d8ba5dd5285}active': true, 'recordType!{5ebb976a-556f-4033-b1d7-9e5976ab963d}MM Property.fields.{39dea2b9-c9f9-4b57-9aeb-62cf86ab5656}createdBy': loggedInUser(), 'recordType!{5ebb976a-556f-4033-b1d7-9e5976ab963d}MM Property.fields.{2612aa2c-ca09-4a4f-87a1-f66b6f08303c}modifiedOn': now() )) ) } ) ) } )
Discussion posts and replies are publicly visible
I think, the up movement is not working because of the missing comma in the line 53 (inside remove())
I'm embarrassed, it was, thank you