저는 뒷받침 빈에서 프라임 멧스 대화 상자를 동적으로 만들고 싶습니다. 내가 작성한 위의 코드 : Primefaces는 닫을 수있는 대화 상자를 프로그램 적으로 엽니 다.
public void showDialog(){
UIComponent panelGroup = facesContext.getViewRoot().findComponent("form1");
System.out.println("found or not??"+ panelGroup.toString());
Dialog dialog = new Dialog();
dialog.setId("sample");
dialog.setWidgetVar("widget");
dialog.setHeader("Sample");
dialog.setVisible(true);
dialog.setMinimizable(true);
dialog.setDynamic(true);
dialog.setHideEffect("fade");
dialog.setFooter("footer");
dialog.setDraggable(true);
dialog.setMinWidth(600);
dialog.setClosable(true);
dialog.setModal(true);
dialog.setAppendToBody(false);
panelGroup.getChildren().add(dialog);
RequestContext requestContext = RequestContext.getCurrentInstance();
requestContext.openDialog("widget");
requestContext.update("form1");
}
내 JSF 페이지에서
: 내가<h:form id="form1" >
<h:commandButton value="show Dialog" action="#{createDialog.showDialog()}" />
</h:form>
이 문제는 내가 가시로 설정하면, 내가 대화 상자를 가지고 있지만 둘 다 내가 닫을 수 있다는 것입니다 (나는 가까운 아이콘을 얻지도 않고 끌 수도 없다)! 그것
requestContext.openDialog("widget");
: 페이지에 다른 Primefaces 대화 프레임 워크 API에
requestContext.execute("PF('widget').show()");
RequestContext.openDialog() 메소드 reffers : 대화 상자 구성 요소
답장 해 주셔서 감사합니다. 문제가 해결되어 문제를 이해할 수있었습니다. 한 가지 더 html 및 jsf 태그가 포함 된 백업에서 대화 상자에 콘텐츠를 추가하려고합니다. 어떻게 그것이 가능할 수 있습니다. Thnx –
양식에 대화 상자를 추가하는 것과 같은 방법으로 대화 상자에 jsf 하위 구성 요소를 추가 할 수 있습니다. 링크는 html을 추가하는 방법을 설명합니다. http://stackoverflow.com/questions/12301817/programmatically-created-html-components-in-jsf-managed-beans – alexSunder