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);
}
}
});
krivopustov
(Konstantin Krivopustov)
October 14, 2016, 6:30am
#2
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);
}
}
});
krivopustov
(Konstantin Krivopustov)
October 17, 2016, 7:13am
#4
Maybe your code in else block reverts the value back?