Setting data- attribute in GWT / Bootstrap

gwt, gwt-bootstrap, twitter-bootstrap

Solution

How about `button.getElement().setAttribute("data-custom","some-custom-data");` ?

Problem

I am working with GWT and implementing bootstrap through GWT-Bootstrap library. I can't seem to find a way to add data- attributes to my elements? I can do it by writing HTML directly: ``` HTMLPanel htmlPanel = new HTMLPanel("<button type=\"button\" class=\"btn\" data-custom=\"some-custom-data\">Hello World</button>"); menuControl.add(htmlPanel); ``` But that's just ugly and defeat the purpose of using GWT (might as well write a plain HTML code). I am looking for ways to do something like: ``` Button button = new Button(); button.setText("Hello World"); button.setStyleName("btn"); // Fine up to here, but now i want: button.setAttr("data-custom", "some-custom-data"); ```

Original source