2011-06-30 38 views
0

所有按鈕如何禁用所有按鈕? 我嘗試RootPanel.getBodyElement().getElementsByTagName("button"),然後我重複它,但...我不知道。禁用與谷歌Web工具包

回答

1

這是做這件事 -

NodeList<Element> e=RootPanel.getBodyElement().getElementsByTagName("button"); 然後 -

for(int i=0;i<e.getLength(); i++) e.getItem(i).setAttribute("disabled", "disabled");

+0

難道你把其他的方法嗎?在某些情況下啓用按鈕時遇到問題。 – barroco

+1

e.getItem(i).removeAttribute(「disabled」); – barroco

+0

另一種方式是跟蹤GWT代碼中的所有按鈕,並在那裏禁用它們。沒有這麼快或簡單。你在啓用按鈕時遇到什麼問題? – Jai