Pregunta

I have following handler

textArea.addKeyDownHandler(new KeyDownHandler() {
            @Override
            public void onKeyDown(KeyDownEvent event) {
                //here
            }
        });

I need to enable save button with id "idsave", but I am not able to refer the button. I am new to GWT, any help would be appreciated.

¿Fue útil?

Solución 2

If you don't have the reference of the button then try with the id.

// get element by id
Element saveButtonElement = RootPanel.get("idsave").getElement(); 

// remove disabled attribute to make it enable
saveButtonElement.removeAttribute("disabled"); 

Otros consejos

Typically, you do not use element ids in GWT. If you created a button, you can simply use it:

private Button saveButton;
...

saveButton = new Button("Save");
textArea.addKeyDownHandler(new KeyDownHandler() {
     @Override
     public void onKeyDown(KeyDownEvent event) {
          saveButton.setEnabled(true);
     }
});
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top