2 Replies Latest reply on Feb 19, 2014 10:07 AM by razvan vasiliu

    Errai data binding

    razvan vasiliu Newbie



        I have an Errai project configured as here (Chapter 8. Data Binding). The model has a bindable annotation and all the fields are bound. The problem is everytime a do a model.getField() "null" is returned. The other way around (using model.setField("text")) sets both the model and the text field. So everytime my input field is updated the model is not synchronized, when I explicitly use set on the model the synchronisation is successfull.

        Do you have an idea of what could I be doing wrong?




        • 1. Re: Errai data binding
          Charles Odili Apprentice

          Can't tell what U are doing wrong if U don't post some of your code here ...

          • 2. Re: Errai data binding
            razvan vasiliu Newbie

            Okay, I can't post the actual code because of an NDA but I can exemplify. So I have a model like this one:




            public class FieldModel {



            private String field;


            ... // getter setter here



            Then I have a widget like this:


            @Templated(Templates.MYTEMPLATE + "#fieldTemplate")

            public class MyWidget{




                private FieldModel model;






                private TextBox field;


                 // now in here the model does not get updated

                 // I had to implement a hack onKeyEvent and on each keypress I have to make a model.setField("new value"); otherwise model.getValue() returns null



            The Errai version I am using is 2.4.3:

            App.GWT.xml is correctly configured to include the databinding inheritance as well as the pom.xml file as described in the http://docs.jboss.org/errai/2.1.0.CR2/errai/reference/html/sid-51282340.html .


            I hope this helps,


            Best Regards,