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