Table: Update a column based on selection of another column in the same table

Hi
I want to update a a column value based on the a selection of checkbox in another column of the same table. The following code is not updating the value. not sure where is the issue.


        recruitmentApplicationsesDs.addItemPropertyChangeListener(e -> {
            if(e.getValue().equals(true)){
                if(e.getItem().getRecruitmentStatus().equals(RecruitmentStatus.New)){
                    e.getItem().setRecruitmentStatus(RecruitmentStatus.Shortlisted);
          //          showNotification("selected",NotificationType.HUMANIZED);
                }
            }else{
                if(e.getItem().getRecruitmentStatus().equals(RecruitmentStatus.Shortlisted)){
                    e.getItem().setRecruitmentStatus(RecruitmentStatus.New);
                }
            }
        });

First of all, when using ItemPropertyChangeListener, check what attribute of the entity has been changed:


recruitmentApplicationsesDs.addItemPropertyChangeListener(e -> {
            if (e.getProperty().equals("myAttr") && e.getValue().equals(true)){

Yes, I did that it is still not working, here is the updated code. When I update theck checkbox in the table I get the notification but no update.


        recruitmentApplicationsesDs.addItemPropertyChangeListener(e -> {
            if (e.getProperty().equals("shortListed") && e.getValue().equals(true)){
                if(e.getItem().getRecruitmentStatus().equals(RecruitmentStatus.New)){
                    e.getItem().setRecruitmentStatus(RecruitmentStatus.Shortlisted);

                    showNotification("selected",NotificationType.HUMANIZED);

                }
            }else{
                if(e.getItem().getRecruitmentStatus().equals(RecruitmentStatus.Shortlisted)){
                    e.getItem().setRecruitmentStatus(RecruitmentStatus.New);
                }

            }

        });

Maybe your code in else block reverts the value back?

Thanks, that worked.