Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Nov 2010
    Posts
    11
    Vote Rating
    0
    Nico P is on a distinguished road

      0  

    Default [GXT 2.2.5] NPE in Checkbox

    [GXT 2.2.5] NPE in Checkbox


    Code:
    at com.extjs.gxt.ui.client.widget.form.CheckBox.setBoxLabel(CheckBox.java:116)
    To reproduce add a checkbox with box label null to a panel.
    If after rendering the lable is changed the NPE is thrown as boxLabelEl is null.

    Code:
    public void setBoxLabel(String boxLabel) {    this.boxLabel = boxLabel;
        if (rendered) {
          boxLabelEl.update(getBoxLabel());
        }
      }
    as of:

    Code:
    @Override  protected void onRender(Element target, int index) {
        ...
        if (boxLabel != null) {
          boxLabelEl = new El(DOM.createLabel());
          ...
        }
    ...
      }

  2. #2
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,716
    Vote Rating
    107
    sven is just really nice sven is just really nice sven is just really nice sven is just really nice

      0  

    Default


    As workaround you should use setBoxLabel("") initially.

  3. #3
    Sencha User
    Join Date
    Nov 2010
    Posts
    11
    Vote Rating
    0
    Nico P is on a distinguished road

      0  

    Default


    Hello Sven,

    thanks again for your fast reply.

    In some cases box labels have to be null. For empty Strings the onRender method adds a label Element to the dom. My workaround overrides the CheckBox#setBoxLabel(String) Method. As in onRender my method adds or removes the label element from the dom depending on the old and new box label.

    Greetings Nico.