2 grids, the first is for selecting rows, and the second is a read only for presenting the first and last name of the row selected.
a!localVariables( local!selection, local!selectedEmployees, { a!columnsLayout( columns: { a!columnLayout( contents: { a!gridField( label: "Read-only Grid", labelPosition: "ABOVE", data: a!queryEntity( entity: cons!EMPLOYEE_ENTITY, query: a!query( selection: a!querySelection( columns: { a!queryColumn( field: "id" ), a!queryColumn( field: "firstName" ), a!queryColumn( field: "lastName" ), a!queryColumn( field: "department" ), a!queryColumn( field: "startDate" ) } ), pagingInfo: fv!pagingInfo ), fetchTotalCount: true ), columns: { a!gridColumn( label: "First Name", sortField: "firstName", value: fv!row.firstName ), a!gridColumn( label: "Last Name", sortField: "lastName", value: fv!row.lastName ), a!gridColumn( label: "Department", sortField: "department", value: a!richTextDisplayField( value: { a!richTextItem( text: {fv!row.department}, linkstyle: "INLINE", color: if(fv!row.department="Sales", "SECONDARY", null), style: { "EMPHASIS" } ) } ) ), a!gridColumn( label: "Start Date", sortField: "startDate", value: fv!row.startDate, align: "END" ) }, pagesize: 5, initialsorts: { a!sortInfo( field: "lastName" ) }, selectable: true, selectionvalue: local!selection, selectionsaveinto: { local!selection, /* This save adds the full rows of data for items selected in the most recent user interaction to local!selectedEmployees. */ a!save(local!selectedEmployees, append(local!selectedEmployees, fv!selectedRows)), /* This save removes the full rows of data for items deselected in the most recent user interaction to local!selectedEmployees. */ if(rule!APN_isEmpty(fv!selectedRows),{}, a!save(local!selectedEmployees, if(rule!APN_isEmpty(fv!deselectedRows),local!selectedEmployees,difference(local!selectedEmployees, fv!deselectedRows))) ) } , selectionrequired: false, disablerowselectionwhen: fv!row.department="Sales", validations: {} ) }, width: "WIDE" ), a!columnLayout( contents: { a!richTextDisplayField( label: "Selected Employees", labelPosition: "ABOVE", value: a!forEach( items: local!selectedEmployees, expression: { a!richTextIcon( icon: "user-circle-o" ), " "& fv!item.firstName & " " & fv!item.lastName, char(10) } ) ) } ) } ) } )
Discussion posts and replies are publicly visible
Temporarily replace your rich text display field (the one starting at line 99) with a paragraph field that just shows the value of local!selectedEmployees, and make sure the data it contains follows what you think it should have as you add or remove rows. BTW, at first glance it seems like your code for removing data as rows are deselected, might not work correctly when all rows are deselected.