Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Some basic questions I can't understand.

    Hello, I'd like to ask some basic questions I can't figure out. I'm using smartgwt 4.1 for the first time.

    1.) For example, I have two presenters binded with two views. On of them is a journal of users and the second one is the form to add user. After adding user I have to return back to the journal presenter. I want to destroy the object of the presenter which adds user. What do I have to do for that reason?

    Code:
     @Override
             public void onResponseReceived(Request request, Response response) {
             PlaceRequest responsePlaceRequest = new PlaceRequest.Builder().nameToken(NameTokens.userDict).build();
             placeManager.revealPlace(responsePlaceRequest);
                                       }
    This is the code of presenter which I use to create user. Do I have to call unbind() after valling revealPlace()??? What is the right approach?

    2.) Sometimes I need to send data from one presenter to another. For example I want to edit object's data. Do I need to use event bus for that?

    3.) As I understood I have to create triple of View-Proxy-Presenter for each page of my application? Is that the right way of using smartGWT?

    #2
    Hi ydmitry,

    please make sure to read the Quick Start Guide and especially the DataSources chapter (page 22/ PDF page 34).

    If you use datasources with the provided SmartGWT widgets, all manual event bus / cache sync becomes unnecessary, as it is automagically handled for you by SmartGWT.
    Add/Update in your form and the journal displays the new data. This works because they are both bound to the same DataSource and the DataSource has a primary key.

    When starting, the builtInDS-sample is a great way to learn.

    Best regards,
    Blama

    Comment


      #3
      Originally posted by Blama View Post
      Hi ydmitry,

      please make sure to read the Quick Start Guide and especially the DataSources chapter (page 22/ PDF page 34).

      If you use datasources with the provided SmartGWT widgets, all manual event bus / cache sync becomes unnecessary, as it is automagically handled for you by SmartGWT.
      Add/Update in your form and the journal displays the new data. This works because they are both bound to the same DataSource and the DataSource has a primary key.

      When starting, the builtInDS-sample is a great way to learn.

      Best regards,
      Blama
      Thank you very much for your response. I used MasterDetails to edit data, but then it was decided to make several pages for that purpose.

      But could you tell me about objects destroying. Do I have to destroy an object every time when I leave the presenter for example?

      Comment


        #4
        Hi ydmitry,

        no you don't. See the Canvas JavaDocs.

        You destroy it if you really don't need it anymore or want to run the Constructor again the next time you display the component to the user (other options are hide() or clear()).

        Also I don't know what you mean by "decided to make several pages for that purpose".
        In SmartGWT an application generally is a one pager (for the browser). All changes are pure JavaScript DOM changes that happen in the 1st page.

        Also note that you only need to destroy (more specific: Canvas.markForDestroy()) the topmost Widget (normally a HLayout or VLayout). All children are destroyed for you. See BaseWidget.destroy()).

        Best regards,
        Blama

        Comment


          #5
          Originally posted by Blama View Post
          Hi ydmitry,

          no you don't. See the Canvas JavaDocs.

          You destroy it if you really don't need it anymore or want to run the Constructor again the next time you display the component to the user (other options are hide() or clear()).

          Also I don't know what you mean by "decided to make several pages for that purpose".
          In SmartGWT an application generally is a one pager (for the browser). All changes are pure JavaScript DOM changes that happen in the 1st page.

          Also note that you only need to destroy (more specific: Canvas.markForDestroy()) the topmost Widget (normally a HLayout or VLayout). All children are destroyed for you. See BaseWidget.destroy()).

          Best regards,
          Blama
          Thank you very much, Blama for your response

          Comment

          Working...
          X