Announcement

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

    Loading data on the listGrid

    Hello,

    Are it possible to made a waiting symbol during data load?

    For example , I click on Ok , during I made all my treatment it's a waiting information on the datagrid, and when I made the setData, it's end.

    It's a few like "Rest Data Source" in your show case but control by my code.

    Thanks by advance.

    Regards

    #2
    If you are using a DataSource to contact the server, for example, by calling DataSource.fetchData(), you can set rpcRequest.showPrompt to true via the DSRequest argument to fetchData(), and this will block user interaction during the network operation. Multiple appearances are available, configurable via rpcRequest.promptStyle.

    For other kinds of waiting indicators, you should create your own, possibly based on the Dialog class.

    Comment


      #3
      Is it possible to set this feature as default for all requests?

      Comment


        #4
        Yes; see DataSource.showPrompt and RPCManager.showPrompt.

        Comment


          #5
          How can i display a show indicator inside the listgrid?

          I can easily made it for the whole page but didn't see wich function use just for the listgrid...

          Comment


            #6
            If you call ListGrid.fetchData() instead of using DataSource.fetchData() plus setData(), the ListGrid.loadingMessage appears automatically, and contains an animated "spinner" icon by default.

            First, consider whether it makes sense to be doing setData() rather than fetchData(). There are use cases where this is a good idea, but they are uncommon.

            If you want to replicate the look of the "loadingMessage" when using setData(), you can set the emptyMessage to be the same as the loading message and manually switch it back to the emptyMessage if you are about to call setData() with an empty data set.

            Comment


              #7
              If someone need to do this use this componment

              Code:
              public class CustomListGrid extends ListGrid {
              
                  private static String imgUrl = "icons/progressCursorTracker.gif";
                  /**
                   * Layout containing the label
                   */
                  Layout loadingLayout = new VLayout();
                  /**
                   * is my loading set
                   */
                  boolean isSet = false;
              
                  /**
                   * Default Constructor
                   */
                  public CustomListGrid() {
                      super();
                      Label loadingLabel = new Label();
                      loadingLabel.setAlign(Alignment.CENTER);
                      loadingLabel.setValign(VerticalAlignment.TOP);
                      loadingLabel.setBorder("10px solid #FFFFFF");
                      loadingLabel.setBackgroundColor("#FFFFFF");
                      loadingLabel.setWidth100();
                      loadingLabel.setHeight100();
                      loadingLabel.setIcon(imgUrl);
                      loadingLabel.setContents(getContent());
              
              
                      loadingLayout = new VLayout();
                      loadingLayout.setAlign(VerticalAlignment.TOP);
                      loadingLayout.setWidth100();
                      loadingLayout.setHeight100();
                      loadingLayout.addChild(loadingLabel);
                      // hide by defaut
                      loadingLayout.hide();
              
                  }
              
                  /**
                   * When the loading begin call this
                   */
                  public void loadingEvent() {
                      // add here : we must add on a full construct componment.
                      if (!isSet) {
                          for (Canvas canva : this.getChildren()) {
                              if (canva.getID() != null && canva.getID().contains("body")) {
                                  canva.addChild(loadingLayout);
                              }
                          }
                          isSet=true;
                      }
              
                      loadingLayout.show();
                  }
              
                  /**
                   * When the loading sop all this
                   */
                  public void stopLoadingEvent() {
              
                      loadingLayout.hide();
                  }
              
                  /**
                   * By default is µLoading Data... Override if you want change it
                   *
                   * @return label to display
                   */
                  public String getContent() {
              
                      return "Loading data...";
                  }
              }
              Last edited by schefferp; 16 Oct 2012, 07:49.

              Comment


                #8
                That works too, but as compared to the suggested strategy, it's more complex and doesn't look as good with frozen columns.

                Note in 3.1 you can call getGridRenderer() rather than searching through all children for the body.

                Comment

                Working...
                X