Results 1 to 7 of 7

Thread: Disbled Buttons added to a PagingToolBar are always enabled

    Success! Looks like we've fixed this one. According to our records the fix was applied for EXTGWT-3045 in 3.0.6.
  1. #1
    Ext GWT Premium Member gdlm's Avatar
    Join Date
    Jan 2012
    Location
    Belgium
    Posts
    220
    Vote Rating
    4
      0  

    Default Disbled Buttons added to a PagingToolBar are always enabled

    Version of Ext GWT
    3.0.0

    Browser versions and OS

    • FF11 on Windows 7 Pro


    Virtual Machine
    No

    Description
    We added several TextButton's to a PagingToolBar.
    Then depending on the number of items in the grid or the number of selected items in the grid we wanted to disable certain buttons. That didn't work out. The buttons always stay enabled.
    Even adding them in disabled state is no solution.

    Run mode
    Development mode (but I guess also in production mode)

    Steps to reproduce the problem
    1. Start running in development mode in Eclipse
    2. Open app in browser
    3. The (initially disabled) buttons in the PagingToolBar are shown enabled.
      In the GXT ToolBar they are shown disabled as expected.


    Expected result
    That the buttons in the PagingToolbar are shown disabled or enabled according to the setEnabled(false/true) call.

    Actual result
    They are always shown enabled.

    Test case

    Here's a tweaked version of the Paging Grid Example.
    But I think you can simply take your code of the Paging Grid Example and add a disabled TextButton to the PagingToolBar to reproduce the issue.
    I also added a GWT ToolBar containing two disabled buttons to see the difference in behaviour.

    Code:
    import java.util.ArrayList;
    import java.util.Date;
    import java.util.List;
    
    import com.google.gwt.cell.client.AbstractCell;
    import com.google.gwt.cell.client.DateCell;
    import com.google.gwt.core.client.EntryPoint;
    import com.google.gwt.core.client.GWT;
    import com.google.gwt.core.client.Scheduler;
    import com.google.gwt.core.client.Scheduler.ScheduledCommand;
    import com.google.gwt.i18n.client.DateTimeFormat;
    import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat;
    import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
    import com.google.gwt.user.client.rpc.AsyncCallback;
    import com.google.gwt.user.client.ui.IsWidget;
    import com.google.gwt.user.client.ui.RootPanel;
    import com.google.gwt.user.client.ui.Widget;
    import com.sencha.gxt.data.client.loader.RpcProxy;
    import com.sencha.gxt.data.shared.ListStore;
    import com.sencha.gxt.data.shared.ModelKeyProvider;
    import com.sencha.gxt.data.shared.loader.LoadResultListStoreBinding;
    import com.sencha.gxt.data.shared.loader.PagingLoadConfig;
    import com.sencha.gxt.data.shared.loader.PagingLoadResult;
    import com.sencha.gxt.data.shared.loader.PagingLoader;
    import com.sencha.gxt.widget.core.client.FramedPanel;
    import com.sencha.gxt.widget.core.client.button.TextButton;
    import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
    import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
    import com.sencha.gxt.widget.core.client.event.SelectEvent;
    import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
    import com.sencha.gxt.widget.core.client.grid.ColumnModel;
    import com.sencha.gxt.widget.core.client.grid.Grid;
    import com.sencha.gxt.widget.core.client.toolbar.PagingToolBar;
    import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
    
    public class PagingGridExample implements IsWidget, EntryPoint {
    
      @Override
      public void onModuleLoad() {
        RootPanel.get().add(this);
      }
    
      @Override
      public Widget asWidget() {
        final ExampleServiceAsync service = GWT.create(ExampleService.class);
    
        RpcProxy<PagingLoadConfig, PagingLoadResult<Post>> proxy = new RpcProxy<PagingLoadConfig, PagingLoadResult<Post>>() {
          @Override
          public void load(PagingLoadConfig loadConfig, AsyncCallback<PagingLoadResult<Post>> callback) {
            service.getPosts(loadConfig, callback);
          }
        };
    
        PostProperties props = GWT.create(PostProperties.class);
    
        ListStore<Post> store = new ListStore<Post>(new ModelKeyProvider<Post>() {
          @Override
          public String getKey(Post item) {
            return "" + item.getId();
          }
        });
    
        final PagingLoader<PagingLoadConfig, PagingLoadResult<Post>> loader = new PagingLoader<PagingLoadConfig, PagingLoadResult<Post>>(proxy);
        loader.setRemoteSort(true);
        loader.addLoadHandler(new LoadResultListStoreBinding<PagingLoadConfig, Post, PagingLoadResult<Post>>(store));
    
        final PagingToolBar toolBar = new PagingToolBar(50);
        toolBar.getElement().getStyle().setProperty("borderBottom", "none");
        toolBar.bind(loader);
    
        TextButton btn1 = new TextButton("Button 1");
        btn1.setEnabled(false);
        toolBar.add(btn1);
        TextButton btn2 = new TextButton("Button 2");
        btn2.setEnabled(false);
        toolBar.add(btn2);
    
          ToolBar gxtToolBar = new ToolBar();
          TextButton btn3 = new TextButton("Button 3");
          btn3.setEnabled(false);
          gxtToolBar.add(btn3);
          TextButton btn4 = new TextButton("Button 4");
          btn4.setEnabled(false);
          gxtToolBar.add(btn4);
    
          ColumnConfig<Post, String> forumColumn = new ColumnConfig<Post, String>(props.forum(), 150, "Forum");
        ColumnConfig<Post, String> usernameColumn = new ColumnConfig<Post, String>(props.username(), 150, "Username");
        ColumnConfig<Post, String> subjectColumn = new ColumnConfig<Post, String>(props.subject(), 150, "Subject");
        ColumnConfig<Post, Date> dateColumn = new ColumnConfig<Post, Date>(props.date(), 150, "Date");
        dateColumn.setCell(new DateCell(DateTimeFormat.getFormat(PredefinedFormat.DATE_SHORT)));
        ColumnConfig<Post, String> iconColumnConfig = new ColumnConfig<Post, String>(props.forum(), 30);
        iconColumnConfig.setSortable(false);
        iconColumnConfig.setCell(new IconCell<String>());
    
        List<ColumnConfig<Post, ?>> l = new ArrayList<ColumnConfig<Post, ?>>();
        l.add(forumColumn);
        l.add(usernameColumn);
        l.add(subjectColumn);
        l.add(dateColumn);
        l.add(iconColumnConfig);
    
        ColumnModel<Post> cm = new ColumnModel<Post>(l);
    
        Grid<Post> grid = new Grid<Post>(store, cm) {
          @Override
          protected void onAfterFirstAttach() {
            super.onAfterFirstAttach();
            Scheduler.get().scheduleDeferred(new ScheduledCommand() {
              @Override
              public void execute() {
                loader.load();
              }
            });
          }
        };
        grid.getView().setForceFit(true);
        grid.setLoadMask(true);
        grid.setLoader(loader);
    
        final FramedPanel cp = new FramedPanel();
        cp.setCollapsible(true);
        cp.setHeadingText("Paging Grid Example");
        cp.setPixelSize(500, 400);
    
        final VerticalLayoutContainer con = new VerticalLayoutContainer();
        con.setBorders(true);
        con.add(grid, new VerticalLayoutData(1, 1));
        con.add(toolBar, new VerticalLayoutData(1, -1));
        con.add(gxtToolBar, new VerticalLayoutData(1, -1));
    
        cp.setWidget(con);
    
        return cp;
      }
    
      public class IconCell<String> extends AbstractCell<String> {
            public void render(Context context, String value, SafeHtmlBuilder builder) {
                if ("Forum 2".equals(value)) {
                    builder.appendHtmlConstant("<image src=\"" + ExampleImages.INSTANCE.add16().getSafeUri().asString() + "\" />");
                } else if ("Forum 3".equals(value)) {
                    builder.appendHtmlConstant("<image src=\"" + ExampleImages.INSTANCE.add12().getSafeUri().asString() + "\" />");
                }
            }
        }
    
    }

    Helpful Information

    Screenshot

    scscreenshot120601002.png

  2. #2
    Ext GWT Premium Member gdlm's Avatar
    Join Date
    Jan 2012
    Location
    Belgium
    Posts
    220
    Vote Rating
    4
      0  

    Default

    @Sencha:
    When considering this problem you should probably have a look at what I describe I discovered in this thread too.

  3. #3
    Ext GWT Premium Member gdlm's Avatar
    Join Date
    Jan 2012
    Location
    Belgium
    Posts
    220
    Vote Rating
    4
      0  

    Default

    >> We will make it our priority to review this report.
    What's the result of that review?

  4. #4
    Sencha Premium Member
    Join Date
    Jul 2012
    Location
    Italy
    Posts
    12
    Vote Rating
    0
      0  

    Default

    I have the same problem... does anybody have any news regarding this issue?

  5. #5
    Sencha - Support Team
    Join Date
    Jan 2012
    Location
    Arlington, WA
    Posts
    871
    Vote Rating
    24
      0  

    Default

    Thanks for the report! I have opened a bug in our bug tracker.

    I moved it to the bug tracker for tracking the issue. We will update the thread when get the fix in.

    Brandon

  6. #6
    Ext GWT Premium Member gdlm's Avatar
    Join Date
    Jan 2012
    Location
    Belgium
    Posts
    220
    Vote Rating
    4
      0  

    Default

    So, one year after my initial report someone posts a new comment and that leads to an entry in your bug tracker at last!
    Maybe you should think about how to avoid such a delay in the future...

  7. #7
    Sencha - Support Team
    Join Date
    Jan 2012
    Location
    Arlington, WA
    Posts
    871
    Vote Rating
    24
      0  

    Default

    Sorry for the delay. The bug is now fixed and will go out in our next release. Alternatively, you can build from SVN or grab a nightly build at https://support.sencha.com/index.php#nightlies.

    Brandon

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •