I have an AjaxFallBackLink that executes an update in a service, but i need
the textArea of the same row to be updated. I have wasted all morning but i
can't still make it work.
I reached this point:
DataView dv = new DataView("dataView",ldp) {
private static final long serialVersionUID = -3315693391867601086L;
@Override
protected void populateItem(Item arg0) {
Label pagina;
final Label codi;
final TextArea valor;
AjaxFallbackLink link;
final StringBuffer vBuffer = new StringBuffer();
final AccTextosWrapper tWrapper = (AccTextosWrapper)arg0.getModelObject();
pagina = new Label("pagina", tWrapper.getPagina());
codi = new Label("codi",tWrapper.getCodi());
codi.setOutputMarkupId(true);
valor = new TextArea("valor", new PropertyModel(tWrapper,"descripcio"));
valor.add(new AjaxEventBehavior("onblur") {
@Override
protected void onEvent(AjaxRequestTarget arg0) {
String val = valor.getModelObjectAsString();
vBuffer.delete(0, vBuffer.length());
vBuffer.append((val == null)?"":val);
}
});
valor.setOutputMarkupId(true);
link = new AjaxFallbackLink("link") {
private static final long serialVersionUID = 3439293533625966929L;
@Override
public void onClick(AjaxRequestTarget arg0) {
String c = codi.getModelObjectAsString();
adminService.updateTextDescripcio(c,vBuffer.toString());
}
};
link.setOutputMarkupId(true);
arg0.add(pagina);
arg0.add(codi);
arg0.add(valor);
arg0.add(link);
}
};
If i don't use validate() and updateModel() i get the same string i had at
the start otherwise i get null.
All works fine but the TextArea model.
Thank you very much for your help