issue with read only grid selection

Hey All,

I have a read only grid with selectable rows. The use case is whenever an user selects a row , a modify button comes up. One interface opens afterwards, with the fields autopopulating from the selected grid values.  Whenever I am updating any field values in update form, its updating in database. Now after updating , the update form closes and we get the original grid back , with that row selected. The selected row value is stored in an ri of type view , multiple type. IF i deselect the row , the RI doesnot get null. If i test it without the modifying feature the RI adds the grid select and removes values if I deselect. I am calling the grid from a parent interface.

Let me know how to resolve the issue.

GrId selection after values update from modify form.

Row deselect ,still RI values populated

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Can you post a code snippet of your selection save into?

  • 0
    A Score Level 1
    in reply to Mike Schmitt

    Hi Mike,

    Grid selection works fine in the child interface. In the parent I/f its creating a problem, only if I modify any grid row values. The RI does not gets null if i Deselect the earlier selected row after modifying the data.

     pagingSaveInto: local!pagingInfo,
        selectable: true(),
        selectionStyle: "ROW_HIGHLIGHT",
        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!selectedCourse. */
          a!save(
            local!selectedCourse,
            append(
              local!selectedCourse,
              fv!selectedRows
            )
          ),
          /*This save removes the full rows of data for */
          /*items deselected in the most recent user*/
          /*interaction to local!selectedCourse. */
          a!save(
            local!selectedCourse,
            difference(
              local!selectedCourse,
              fv!deselectedRows
            )
          ),
          a!save(
            ri!selectedCourse,
            local!selectedCourse
          ),
          
          
        },

  • 0
    A Score Level 3
    in reply to Shikha

    How do you implement the modification feature. In case you use the local!selectedCourse, then I think the issue is that fv!deselectedRows is not the same value anymore as local!selectedCourse because you modified it. Because of this, line 22 does not work anymore and does not remove the deselected item from the list.

    Does this make sense?

    I assume that your intention is, to only allow a single item to be selected. Then you might not need this complex saveInto anymore, but could just store the last item in fv!selectedRows into local!selectedCourse and/or ri!selectedCourse.

  • 0
    A Score Level 1
    in reply to Stefan Helzle

    Hi Stefan ,

    The scenario is like that a user can only select a single row for modification . User selects a row, click on modify button , an interface pops up with the grid values. The grid values comes from a View. So via query entity, I am fetching the ID from the view and Passing that ID to get the data from the table . So if user modifies any text fields within the modify interface, the values are updated in the source table as well as the grid data is updated.

    Moreover I noticed, the RI selected course doesn't get updated after I modify any grid data.Initially while selecting grid , RI holds the data fine. This is the save into code of the modify i/f if that helps. Local!modifyCouseData holds the new updated values which user enters. The values are getting saved in course table.

        a!buttonWidget(
                    label: "Save",
                    value: local!buttonAction,
                    saveInto: {
                      a!save(
                        local!modifyCourseData.updatedOn,
                        now()
                      ),
                      a!save(
                        local!modifyCourseData.updatedBy,
                        loggedInUser()
                      ),
                      a!writeToDataStoreEntity(
                        dataStoreEntity: cons!PLC_DSE_COURSE,
                        valueToStore: local!modifyCourseData
                      ),
                   
                      a!save(
                        local!modifyCourseData,
                        null
                      ),
                      a!save(
                        ri!buttonAction,
                        null
                      ),
                      
                      
                    },
                    style: "PRIMARY",
                    validate: true(),
                    
                  ),

  • 0
    A Score Level 3
    in reply to Shikha

    Did you try to modify the saveInto of the grid as I suggested? I think relying on append() and difference() for just storing the last selected item is a bit of an overkill.

    But my analysis could be completely wrong.

  • 0
    A Score Level 1
    in reply to Stefan Helzle

    Ok , so I did this in the grid code. I have removed append and difference code.The RI takes the last selected row value. On deselecting that row , RI becomes null. But the RI does not hold the previously selected rows due to absence of append obviously.  This causes an issue with grid selection as user can come back to previously selected row and modify that , not necessary that he modifies the last clicked row. The RI stores values for last clicked row and make that null on deselect.

     selectionSaveInto: {
          local!selection,
          /*This save adds the full rows of data for items*/
          /*selected in the most recent user interaction*/
          /*to local!selectedCourse. */
          a!save(
            local!selectedCourse,
           fv!selectedRows
          ),
          /*This save removes the full rows of data for */
          /*items deselected in the most recent user*/
          /*interaction to local!selectedCourse. */
         
          a!save(
            ri!selectedCourse,
            local!selectedCourse
          ),
          
          
        },
        validations: if(
          count(
            local!selection
          ) > 1,
          "PLEASE SELECT A SINGLE COURSE VALUE FOR UPDATE.",
          null
        )

Reply
  • 0
    A Score Level 1
    in reply to Stefan Helzle

    Ok , so I did this in the grid code. I have removed append and difference code.The RI takes the last selected row value. On deselecting that row , RI becomes null. But the RI does not hold the previously selected rows due to absence of append obviously.  This causes an issue with grid selection as user can come back to previously selected row and modify that , not necessary that he modifies the last clicked row. The RI stores values for last clicked row and make that null on deselect.

     selectionSaveInto: {
          local!selection,
          /*This save adds the full rows of data for items*/
          /*selected in the most recent user interaction*/
          /*to local!selectedCourse. */
          a!save(
            local!selectedCourse,
           fv!selectedRows
          ),
          /*This save removes the full rows of data for */
          /*items deselected in the most recent user*/
          /*interaction to local!selectedCourse. */
         
          a!save(
            ri!selectedCourse,
            local!selectedCourse
          ),
          
          
        },
        validations: if(
          count(
            local!selection
          ) > 1,
          "PLEASE SELECT A SINGLE COURSE VALUE FOR UPDATE.",
          null
        )

Children
No Data