Menu

#617 Bug on setValueNotifying

Not planned
open
nobody
None
5
2016-02-19
2016-02-19
No

As discussed on this thread:
https://sourceforge.net/p/openxava/discussion/419690/thread/568c99b4/

I have 3 Models: Cliente, PlanoConta and Financeiro and an Onchange class.

They are something like this:

public class Cliente{
   private PlanoConta planoConta1;
   private PlanoConta planoConta2;
}

public class PlanoConta{
  Integer id;
  String descricao;
}

public class Receber{
   @OnChange(OnClienteChange.class)
   private Cliente cliente;
   private PlanoConta planoConta1;
   private PlanoConta planoConta2;
}

public class OnClienteChange extends blabla{
  public void onChange(){
    Cliente cli = getTheCliente();
    getView().setValueNotifying("planoConta1.id", cli.planoConta1);
    getView().setValueNotifying("planoConta2.id", cli.planoConta2);
  }
}

The problem is on the onchange class. It executes, it fills both ID, but it will show the description of planoConta1 only! The planoConta2 description field is in blank. If I swap the lines like this:

    getView().setValueNotifying("planoConta2.id", cli.planoConta2);
    getView().setValueNotifying("planoConta1.id", cli.planoConta1);

The problem "inverts". Now planoConta1 description field will be left blank. It seems like the second time I call setValueNotifying, it doesn't notify. I just can't understand why!

As a workaround I am using this code now:

        getView().setValueNotifying("planoContaReceita.id", c.getPlanoContaReceita().getId());
        getView().setValueNotifying("planoContaRecebimento.id", c.getPlanoContaPagamento().getId());
        //Estas duas linhas é um workaround pois a linha logo acima não carrega o código e descrição do plano de contas
        getView().setValueNotifying("planoContaRecebimento.codigo", c.getPlanoContaPagamento().getCodigo());
        getView().setValueNotifying("planoContaRecebimento.descricao", c.getPlanoContaPagamento().getDescricao());

Discussion


Log in to post a comment.