0
종속 스타일을 제거하는 방법?gwt 대화 상자 헤더에서 스타일 제거
GWT 대화 상자에서 .dialogtopleft
을 .gwt-Dialogbox . dialogtopleft
에서 제거해야합니다.
어떻게 제거하나요?
종속 스타일을 제거하는 방법?gwt 대화 상자 헤더에서 스타일 제거
GWT 대화 상자에서 .dialogtopleft
을 .gwt-Dialogbox . dialogtopleft
에서 제거해야합니다.
어떻게 제거하나요?
쉽게하려면 jQuery가 필요합니다. GWT에 대한 jQuery 래퍼를 찾을 수 있지만 일반 DOM 통과를 사용하여 수행 할 수도 있습니다.
주어진 클래스 이름별로 요소를 찾는 재귀 적 방법이 있습니다. 발견 된 첫 x 째 요소 또는 널 (NULL)을 리턴합니다.
public Element findChildElementByClassName(Element parent, String className) {
List<String> classNames = Arrays.asList(parent.getClassName().split(" "));
if(classNames.contains(className))
return parent;
else {
Element foundElement = null;
NodeList<Node> childNodes = parent.getChildNodes();
for(int i = 0; i < childNodes.getLength() && foundElement == null; i++)
if(childNodes.getItem(i).getNodeType() == Node.ELEMENT_NODE) {
Element childElement = (Element) childNodes.getItem(i);
foundElement = findChildElementByClassName(childElement, className);
}
return foundElement;
}
}
자기 설명이되기를 바랍니다. 그러나 노드 유형을 요소에 캐스팅하기 전에이를 확인해야합니다.
DialogBox dialogBox = new DialogBox();
// ... initialize dialogBox
dialogBox.show();
Element dialogTopLeftElement = findChildElementByClassName(dialogBox.getElement(), "dialogTopLeft");
if(dialogTopLeftElement != null)
dialogTopLeftElement.removeClassName("dialogTopLeft");
:
당신은이 방법을 사용한다