voyent
ice:panelStack inside ace:dialog not working  XML
Forum Index -> Components
Author Message
avinniva

Joined: 27/Feb/2013 19:56:41
Messages: 14
Offline


I have ice:panelStack inside ace:dialog box. On dialog box pop up default selected panel displayed correctly. However, on changing selection to different panel, dialog closes instead of displaying newp panel. Is something wrong here?


Code:
    <ace:dialog id="dialog" >
         <h:form>
             <h:panelGrid columns="2" class="grid">
                 
                 <h:outputLabel value="Select Action :"/>
                 <ace:simpleSelectOneMenu  value="#{dealDialogBean.action}" valueChangeListener="#{dealDialogBean.actionChanged}" >
                     <f:selectItem itemValue="ViewPanelId" itemLabel="View" />
                     <f:selectItem itemValue="EditPanelId" itemLabel="Edit" />
                 </ace:simpleSelectOneMenu>
            </h:panelGrid>
 
             <ice:panelStack selectedPanel="#{dealDialogBean.selectedPane}">
                 <ice:panelGroup id="ViewPaneId">
                     <ace:dataTable> ..with outputText rows. </ace:dataTable>
                 </ice:panelGroup>
                 <ice:panelGroup id="ViewPaneId">
                     <ace:dataTable> ..with editable rows. </ace:dataTable>
                 </ice:panelGroup>
            </ice:panelStack>
    
           
       ...submit butoon..
         </h:form>
     </ace:dialog>  
 
 
philip.breau


Joined: 08/May/2006 00:00:00
Messages: 2989
Offline


It's likely that a DOM update is happening in the browser that includes the root element for the dialog. You can try binding the 'visible' attribute of the ace:dialog and setting that server side so any updates won't reset the dialog.

But I would also recommend using a dynamic ui:include rather than the ice:panelStack, which is a legacy component. It was only really needed for JSP pages in 1.8, which couldn't use Facelets. Using a dynamic ui:include will be much more efficient.

Philip

.
avinniva

Joined: 27/Feb/2013 19:56:41
Messages: 14
Offline


Thanks, that helped. I have added following line in select change listener and now dialog stays open.


JavaScriptRunner.runScript(FacesContext.getCurrentInstance(), "dealDialog.show(); updateGrowl();");


However the inputtexBox are keep loosing focus. I am not even able to enter text or select any text in dialog box. How can I fix this?
philip.breau


Joined: 08/May/2006 00:00:00
Messages: 2989
Offline


You might need to analyze the DOM update that's coming back or compare the DOM before and after to see if some elements or attributes in the DOM are changing that might not need to. If you get rid of the ice: tags you can also use the ace:ajax or f:ajax tags with their 'render' attribute to pinpoint what exactly should be updated. This might help a focus issue.

We also have a new tag called icecore:focusManager in the trunk that you could try out:

http://jira.icesoft.org/browse/ICE-9483

.
avinniva

Joined: 27/Feb/2013 19:56:41
Messages: 14
Offline


Using ui:include and defining dynamic part inside separate test.xhtml file as follow:



Code:
<ui:composition 
     xmlns="http://www.w3.org/1999/xhtml"
     xmlns:f="http://java.sun.com/jsf/core"
     xmlns:h="http://java.sun.com/jsf/html"
     xmlns:ui="http://java.sun.com/jsf/facelets">
 
 		<ice:panelGrid columns="2" cellspacing="0" cellpadding="3"
 			columnClasses="col25,col75">
 			<h:outputText value="Name: "></h:outputText>
 			<h:outputText value="#{dealUpdateDialogBean.name}">
 </h:outputText>
                <ice:panelGrid>
 
 </ui:composition>
[code]

I am getting following error:
Error Parsing /test.xhtml: .. The prefix "ice" for element "ice:panelGrid" is not bound.
philip.breau


Joined: 08/May/2006 00:00:00
Messages: 2989
Offline


Looks like you're missing xmlns:ice on the ui:composition tag. But why not just change ice:panelGrid to h:panelGrid?

.
avinniva

Joined: 27/Feb/2013 19:56:41
Messages: 14
Offline


I am have used i:include now, still getting same problem of hiding dialog with selection change and not able to set focus (input value) on changed panel/page.
avinniva

Joined: 27/Feb/2013 19:56:41
Messages: 14
Offline


Can you please give me example of focusManager. I am not able find in showcase or how to use it?
philip.breau


Joined: 08/May/2006 00:00:00
Messages: 2989
Offline


It's only in the trunk. Details are in the jira.

.
avinniva

Joined: 27/Feb/2013 19:56:41
Messages: 14
Offline


What other way in java code, I can set focus?

I tried following, but it is not working:
JavascriptContext.applicationFocus(FacesContext.getCurrentInstance(), "nameInputTextId.focus();");

Any suggestion?
philip.breau


Joined: 08/May/2006 00:00:00
Messages: 2989
Offline


Is nameInputTextId a string in the javascript context? I'm not clear on how nameInputTextId.focus() would work. Have you tried JavaScriptContext.applicationFocus(FacesContext ctx, String id)?

.
avinniva

Joined: 27/Feb/2013 19:56:41
Messages: 14
Offline


nameInputTextId is inputText component Id. I have also tried

JavascriptContext.applicationFocus(FacesContext.getCurrentInstance(), "nameInputTextId");

Still could not get focus to change text. Focus keeps moving out of dialog.
philip.breau


Joined: 08/May/2006 00:00:00
Messages: 2989
Offline


Try using the clientId (ie. the id of the HTML element that you want to set focus to), rather than the id of the component, which won't be the same.

.
avinniva

Joined: 27/Feb/2013 19:56:41
Messages: 14
Offline


This was issue on chrome only, worked good in IE. I thought chrome works better with javascript :)


Setting applicationFocus twice after selection change fixes issue.
 
Forum Index -> Components
Go to:   
Powered by JForum 2.1.7ice © JForum Team