1 2 Previous Next 21 Replies Latest reply on Jul 9, 2013 9:00 AM by holsen Go to original post
      • 15. Re: Navigate @Page with pass parameters
        jfuerth

        Aha, now that I can see Page2, I'm happy to report it's a simple problem.

         

        You just forgot the @AutoBound and @Bound annotations in Page2. Do this:

         

        @Page

        @Templated("#template")

        public class Page2 extends Composite{

         

            @Inject @AutoBound DataBinder<MyData> dataBinder;

            @Inject MyData myData;

         

            @Inject @Bound @DataField Label text;

         

            @PageShowing

            public void pageShowing(HistoryToken historyToken)  {

                dataBinder.setModel( myData);

            }

        }

         

        Cheers,

        Jonathan

        • 16. Re: Navigate @Page with pass parameters
          holsen

          Jonathan, thanks for you reply! I'm afraid it is still not working. When I debug the application the databinder on Page1 fills the MyData Object just fine. However, when the @PageShowing method is called, the MyData object is emtpy. When leave out the DataBinder on Page1 and set the data manually, it works. I've attached the source code in my previous post in a ZIP file.

           

          Cheers,

           

          Christian

          • 17. Re: Navigate @Page with pass parameters
            csa

            Hi Chris,

             

            Which version of Errai are you using?

             

            In case of Errai 2.3.* this should work but you will have to call dataBinder.setModel(myData, InitialState.FROM_MODEL) in Page2 to force an update of the UI. This is not required in 2.4 (FROM_MODEL is the default there).

             

            However, there's currently an injection related problem in 2.4.0.Beta1 which prevents this from working. I am looking into this.

             

            Cheers,

            Christian

            • 18. Re: Navigate @Page with pass parameters
              csa

              OK new 2.4.0-SNAPSHOTs have been published. So, in case you're using 2.4, it should work there as well now.

              • 19. Re: Navigate @Page with pass parameters
                holsen

                Hey everyone, thanks for your support! I had actually tried InitialState.FROM_MODEL. I'm using 2.3.2 and just tried 2.4 with the same result. It's very strange. I'm probably making some simple mistake, yet I cannot find it. Is there any other way which I could use for passing objects between pages, other than JPA?

                • 20. Re: Navigate @Page with pass parameters
                  csa

                  Hi Chris,

                   

                  I attached a sample project (test.zip) which does what you want to do. It's a really simple example using only the two pages.

                   

                  The feature we're missing to make this easier is Page/Activity scopes. Then, we could tie the @Model or the DataBinder to that scope. It's on our roadmap.

                   

                  Cheers,

                  Christian

                  • 21. Re: Navigate @Page with pass parameters
                    holsen

                    Hi Christian,

                     

                    thank you so much! I just had a look at your code, it works just fine. So all I had to do is add
                    dataBinder.selModel( ...)  on the first page as well, I guess otherwise a new instance of MyData will be created, even though it is @ApplicationScoped.

                     

                    Cheers,

                     

                    Chris

                    1 2 Previous Next