For better understanding what I want to achieve I have opened new Q. on StackOverflow. Thank you in advance on your efforts to enlighten me. :)
http://stackoverflow.com/questions/26456425/updating-checked-property-with-a-value-from-select-button-in-tapestry > From: wintertime0...@outlook.com > To: users@tapestry.apache.org > Subject: Update checkbox within Form for changing value of a row > Date: Sat, 18 Oct 2014 21:32:15 +0100 > > I have a code like this: > > /** > * > * @author > */ > public class POS { > > @Inject > private Request request; > @Inject > private BiznisLogika tiketDao; > @Inject > private Session session; > @InjectComponent > private Zone result; > @SessionState > @Property > private SearchCriteria criteria; > @SessionState > @Property > private SearchCriteriaTwo criteriaTwo; > @SuppressWarnings("unused") > @Property > private GridDataSource source = new TicketDataSource(session, > Tiket.class); > @SuppressWarnings("unused") > @Property > private Tiket currentTicket; > @Property > @Persist > private TiketStatus noviStatus; > @Property > private SelectModel tiketSelectModel; > @Inject > SelectModelFactory selectModelFactory; > @Inject > private Session hibernate; > @Inject > private GenericDao genericDao; > > void setupRender() { > criteriaTwo = null; > criteria = null; > } > > private final class TicketDataSource extends HibernateGridDataSource { > > private TicketDataSource(Session session, > @SuppressWarnings("rawtypes") Class entityType) { > super(session, entityType); > } > > @Override > public int getAvailableRows() { > return criteria.getSearchPattern() == null ? 0 : > super.getAvailableRows(); > } > > @Override > protected void applyAdditionalConstraints(Criteria crit) { > crit.add(Restrictions.ilike("ticketSerial", > criteria.getSearchPattern())).add(Restrictions.ilike("ticketDate", > criteriaTwo.getSearchPattern())); > } > } > > void onValidateFromDelete() { > // Unfortunately, this method is never called because Checkbox > doesn't bubble up VALIDATE. It's a shame because > // this would be the perfect place to validate whether deleting is > OK, or to put an entry in deleteCopyByRowNum. > // Please vote for https://issues.apache.org/jira/browse/TAP5-2075 . > } > // The Loop component will automatically call this for every row as it is > rendered. > > public boolean isDelete() { > return false; > } > > // The Loop component will automatically call this for every row on > submit. > public void setDelete(boolean delete) { > } > > @OnEvent(value = EventConstants.SUCCESS) > Object searchTickets() { > return request.isXHR() ? result.getBody() : null; > } > > Object onAction() { > > return request.isXHR() ? result.getBody() : null; > > } > > public ValueEncoder<TiketStatus> getTiketStatusEncoder() { > return new ValueEncoder<TiketStatus>() { > @Override > public String toClient(TiketStatus value) { > // return the given object's ID > return String.valueOf(value); > } > > @Override > public TiketStatus toValue(String id) { > return TiketStatus.valueOf(id); > // return (Tiket) genericDao.getById(Tiket.class, > Long.parseLong(id)); > } > }; > } > > @CommitAfter > Object onSaveThemAll() { > for (int i = 0; i < source.getAvailableRows(); i++) { > currentTicket.setTicketStatus(noviStatus); > hibernate.merge(currentTicket); > > > } > return request.isXHR() ? result.getBody() : null; > > } > > } > > > > " > > > > > > > Buscar > > > > > > Resultados > > > > > or cancel > > > > > > > > > > > > > ${message:no-result} > > > > > > > > > > > Save" > > > Now, I want to update when checked checkbox each row of a grid with new > Status. I have tried with a method onSaveThemAll, but it doesn't work, since > I have no idea how to check if checkbox is checked and how to update each > row(ticket) with a new state. Any help is appreciated. > > > P.S. I have provided an image for better understanding what I want to achieve > here. > > http://postimg.org/image/lnlwb7fkb/ >