0

I am using GXT 2.2.1 and GWT 2.0.4in my project and I want to disable the "Add all" button in DualListField. Please help

shis84
  • 3
  • 2

2 Answers2

0

I don't find an API to disable the 'Add all'. You can extend the DualListField and disable the allRight button.

public class CustomDualListField<D extends ModelData> extends DualListField<D> {
      @Override
      protected void onRender(Element target, int index) {
         super.onRender(target, index);
         allRight.disable();

        //buttonBar.remove(allRight);
        //buttonBar.remove(allLeft);
      }
}

Here I see that even though the button is disabled, it does not look like disabled. You can consider removing it completely.

I have tried this in GXT 2.2.5 and GWT 2.4. Just check it if it works fine with GXT 2.2.1

Ganesh Kumar
  • 3,220
  • 1
  • 19
  • 27
0

You can also just hide the button. In addition, I tried to give the attribute visible in false, but this did not work too. However, hide the button turned out.

public class CustomDualListField<D extends ModelData> extends DualListField<D> {
      @Override
      protected void onRender(Element target, int index) {
         super.onRender(target, index);
        //allRight.disable();

        //buttonBar.remove(allRight);
        //buttonBar.remove(allLeft);

        //allRight.setEnabled(false); // but not disabled
        //allLeft.setEnabled(false); // but not disabled

        allRight.setVisible(false); // just hide
        allLeft.setVisible(false); // just hide
      }
}
titaniche
  • 197
  • 1
  • 1
  • 10