i can't reproduce your problem,on clicking cancel ,the precondition should fail ie. return false which is what the code is doing,what browser are you using? i tested it on chrome/firefox
On Mon, Oct 22, 2012 at 3:33 PM, Marco Di Sabatino Di Diodoro <[email protected]> wrote: > Hi, > > I implemented following your suggestions. Currently, the list item is deleted > if I press ok or cancel in the dialog. > > item.add(new AjaxDecoratedCheckbox("toRemove", new > Model<Boolean>(Boolean.FALSE)) { > private static final long serialVersionUID = > 7170946748485726506L; > > @Override > protected void onUpdate(final AjaxRequestTarget target) { > ----------> > entityTO.getDerivedAttributes().remove(attributeTO); > target.add(attributesContainer); > } > > @Override > protected void updateAjaxAttributes(AjaxRequestAttributes > attributes) { > super.updateAjaxAttributes(attributes); > > IAjaxCallListener myAjaxCallListener = new > AjaxCallListener() { > private static final long serialVersionUID = > 7160235486520935153L; > > @Override > public CharSequence getPrecondition(Component > component) { > return "if (!confirm('" + > getString("confirmDelete") + "'))" + "{return false;}"; > } > }; > > attributes.getAjaxCallListeners().add(myAjaxCallListener); > } > }); > > What should I call to handle ok or cancell event? > > Marco > > On Oct 19, 2012, at 6:10 PM, vineet semwal wrote: > >> iajaxcalldecorator is replaced with >> iajaxcalllistener,ajaxcalllistener(dummy implementation) >> is what you can extend for your use ,override >> ajaxcheckbox#updateAjaxAttributes(attributes) >> like below >> @Override >> protected void updateAjaxAttributes(AjaxRequestAttributes >> attributes) { >> attributes.getAjaxCallListeners().add(new AjaxCallListener(){ >> @Override >> public CharSequence getPrecondition(Component component) { >> return "if (!confirm('" + >> getString("confirmDelete") + "'))" + "{ return false; } " ; >> } >> }); >> } >> >> On Fri, Oct 19, 2012 at 8:47 PM, Marco Di Sabatino Di Diodoro >> <[email protected]> wrote: >>> Hi all, >>> >>> How can i convert this code into wicket 6.1. >>> >>> item.add(new AjaxDecoratedCheckbox("toRemove", new >>> Model<Boolean>(Boolean.FALSE)) { >>> >>> @Override >>> protected void onUpdate(final AjaxRequestTarget target) { >>> entityTO.getDerivedAttributes().remove(attributeTO); >>> target.add(attributesContainer); >>> } >>> >>> @Override >>> protected IAjaxCallDecorator getAjaxCallDecorator() { >>> return new >>> AjaxPreprocessingCallDecorator(super.getAjaxCallDecorator()) { >>> >>> @Override >>> public CharSequence preDecorateScript(final CharSequence script) { >>> return "if (confirm('" + getString("confirmDelete") + "'))" + "{" + >>> script + "} " >>> + "else {this.checked = false;}"; >>> } >>> }; >>> } >>> }); >>> >>> I see the migration doc, but i not found a solution. >>> >>> Thanks >>> M >>> >>> >>> -- >>> >>> Dott. Marco Di Sabatino Di Diodoro >>> Tel. +39 3939065570 >>> >>> Tirasa S.r.l. >>> Viale D'Annunzio 267 - 65127 Pescara >>> Tel +39 0859116307 / FAX +39 0859111173 >>> http://www.tirasa.net >>> >>> Apache Syncope PPMC Member >>> http://people.apache.org/~mdisabatino >>> >>> >>> >>> >> >> >> >> -- >> regards, >> >> Vineet Semwal >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> > > -- > > Dott. Marco Di Sabatino Di Diodoro > Tel. +39 3939065570 > > Tirasa S.r.l. > Viale D'Annunzio 267 - 65127 Pescara > Tel +39 0859116307 / FAX +39 0859111173 > http://www.tirasa.net > > Apache Syncope PPMC Member > http://people.apache.org/~mdisabatino > > > > -- regards, Vineet Semwal --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
