ModalDialog Internet Explorer

0 respostas
superminina

Pessoal,

Eu tenho uma página de listagem, com um botão que chama uma DialogModal para inclusão de um novo registro...
A chamada é popup = window.showModalDialog ( url, '', "status:false;dialogWidth:850px;dialogHeight:400px;"); para o IE9

Meu problema?

Quando o usuário confirma a inclusão de um novo registro, eu preciso persistir no banco e fechar a janela modal.
Fazendo da seguinte forma:
String javaScriptText = "window.close();return false;";
AddResource addResource = AddResourceFactory.getInstance(facesContext);
addResource.addInlineScriptAtPosition(facesContext, AddResource.HEADER_BEGIN, javaScriptText);

No Firefox funciona lindamente! No IE9, a janela "dá cria"! Ele cria uma nova janela, pergunta se eu desejo fechá-la, mas não fecha a janela modal.
Nessa mesma tela, eu tenho o botão "Cancelar" que eu boto no onClick o comando window.close();return false; e ele fecha a janela....

Já coloquei no head o comando <base target="_self"/>

Chamada do botão para abrir a Dialog:
&lt;h:outputLink id="olcreateCategoriaServicoInput"
						onclick="criarNovoOnclick('#{categoriaServico_listCategoriaServicoResult.webContext}', this);"
						styleClass="imagemBotao" title="Incluir"
						value="listCategoriaServicoResult.jsf"&gt;
						&lt;h:graphicImage style="border: 0" url="/images/botoes_r4_c1.jpg" /&gt;
					&lt;/h:outputLink&gt;
JavaScript
function criarNovoOnclick(webContextLocal, elemento){

	pagina = getField('nmPagina').value;
	width = getField('width').value;
	height = getField('height').value;
	
	parametros = '&parametros=0';
	
	abrirPopup(webContextLocal, elemento, pagina, width, height, parametros);

}

function abrirPopup(webContextLocal, elemento, pagina, width, height, parametros)  {  

	form = document.getElementById( getFormName() );
  
  	action     = form.action;  
  	beginIndex = action.indexOf('.target.') + 8;
  	endIndex   = action.indexOf('.iWorkplace');
  
  	element = elemento.id;
  
  
  	//Definir parametros
  	formOrigem = getFormName();
  
  	params = '?idPagina=' + element;
  
  	//Dentro do portal
  	if (endIndex != -1) {    
    	portletId  = action.substring(beginIndex, endIndex);
 
  		url = action + 
          	'?iWorkplace_Application_Context=' + webContextLocal + 
          	'&iWorkplace_detach_target=' + portletId +
          	'&iWorkplace_portlet_border=false' +
          	'&iWorkplace_Portal_URL_Channel_' + portletId + '=' + webContextLocal + pagina +
         	 parametros;
                
   	//Fora do portal
  	} else {
    	url   = webContextLocal + pagina + parametros;
  	}

	uniqueName = &quot;popup&quot; + new Date().getTime();

	// VERIFICA O NAVEGADOR
	if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
 		var ieversion=new Number(RegExp.$1)
 		//if (ieversion&lt;9){
 			//alert('O sistema funciona corretamente na versão 9 ou superior deste navegador.');
 		//}
 		popup = window.showModalDialog ( url, '', &quot;status:false;dialogWidth:850px;dialogHeight:400px;&quot;);
 		
	} else{
		popup = window.showModalDialog( url, '', +
 			' toolbar:no;scrollbars:1; status:no; ' +
 			' menubar:no; fullscreen:no; location:no; '+
 			' directories:no;dialogLeft:270; dialogTop:200; '+
 			' dialogWidth:'+ width+ '; '+
 			' dialogHeight:' + height+'; '+
 			' resizable:yes');
	}
}
Ação do botão
public void cbCreateCategoriaServicoListener(ActionEvent event) {
        try {
            if(this.isEmptyOrNull(categoriaServicoTO.getNmCategoriaServico())){
                throw new VixtiExternalException(&quot;A descrição da Categoria do Serviço deve ser informada.&quot;);
            }
            if(this.isEmptyOrNull(categoriaServicoTO.getNmReduzidoCategoria())){
                throw new VixtiExternalException(&quot;A descrição reduzida da Categoria do Serviço deve ser informada.&quot;);
            }
            this.categoriaServicoTO.setStCategoriaServico(SigestTP._ST_ATIVO);
            CategoriaServicoBD.getInstance().createCategoriaServico(this.getCategoriaServicoTO());
            this.addOKMessage(&quot;Categoria de Serviço criada com sucesso.&quot;, &quot;Categoria de Serviço&quot;);
            FacesContext facesContext = FacesContext.getCurrentInstance();

            String javaScriptText = &quot;window.close();return false;&quot;;

            // Add the Javascript to the rendered page's header for immediate execution
            AddResource addResource = AddResourceFactory.getInstance(facesContext);
            addResource.addInlineScriptAtPosition(facesContext, AddResource.HEADER_BEGIN, javaScriptText); 
           
        } catch (Throwable t) {
            addMessage(t);
            throw new AbortProcessingException();
        }
    }

Obrigada.

Criado 18 de fevereiro de 2013
Respostas 0
Participantes 1