Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

rich tabpanel : first rich tab not loaded with focus with first tab

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a page with a button say button 1 which opens a rich popup panel, the popup panel has rich tabpanel within it with rich tab, and a4j command button.

Now if i click the second tab in the rich tabpanel and click the a4j command button, the command button does some processing and hides the popup panel.

Afterward when the button i.e button 1 on the page is fired , the popup panel is loaded but the rich tab within the popup panel has the second tab in focus instead of first tab.

I think the focus should be on the first tab. I'm not able to identify the problem.

here is the page code.

<div id="mydiv">
<h:form>
<a4j:commandButton onclick="maskk()" render=":pnl :tt :ttt" action="#{test.testAction}" value="test_action" oncomplete="#{rich:component('popUpPanel1')}.show();return false;"/>
</h:form>
</div>





<div id="mydiv1">
<rich:popupPanel id="popUpPanel1" modal="false" height="300" width="500">
<f:facet name="header">
<h:outputText value="Header Test Panel" />
</f:facet>
<f:facet name="controls">
<h:graphicImage alt="X" onclick="#{rich:component('popUpPanel1')}.hide()"/>
</f:facet>
<h:panelGroup id="pnl">
<h:form id="popUpPanelFrm">
<a4j:commandButton value="test" action="#{test.testAct}" oncomplete="#{rich:component('popUpPanel2')}.show();return false;"/>
</h:form>
</h:panelGroup>
</rich:popupPanel>
</div>



<rich:popupPanel id="popUpPanel2" modal="false">
<f:facet name="header">
<h:outputText value="Test Only Panel" />
</f:facet>
<f:facet name="controls">
<h:graphicImage alt="X" onclick="#{rich:component('popUpPanel2')}.hide()"/>
</f:facet>

<h:form id="aa">
<a4j:commandButton action="#{test.testAct}" value="btn_popUpPanel2"/>

<rich:tabPanel switchType="ajax" id="nrt" style="font-size: 20px">
<rich:tab header="Notes" id="n">
<h:inputTextarea id="note" value="#{test.note}" style="width: 350px;height: 70px"/>
</rich:tab>
<rich:tab header="Recommendations" id="r">
<h:inputTextarea id="recommendation" value="#{test.recom}" style="width: 350px;height: 70px"/>
</rich:tab>
</rich:tabPanel>
<h:panelGroup id="nrPopUpPanelBtn">

<a4j:commandButton style="margin: 5px 0 0 0px" id="btnSubmit" oncomplete="#{rich:component('popUpPanel2')}.hide();unmaskk();" action="#{test.testNR}" value="Ok"/>
<a4j:commandButton style="margin: 5px 0 0 20px" id="btnCancle" onclick="#{rich:component('popUpPanel2')}.hide();unmaskk();" value="Cancel"/>
</h:panelGroup>
</h:form>
</rich:popupPanel>



Thanks You


 
Brajendra Mathema
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
any help ?

thankyou
 
Saloon Keeper
Posts: 26057
186
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, first, popups in RichFaces are not loaded at display time. They are loaded when the page loads, but are hidden. The show() method simply takes the panel and makes it visible as an overlay DIV on the page and the hide() method makes it invisible again.

JSF does not concern itself with focus in any event. You should be able to set an "onshow" attribute for the tab and have the code in that attribute direct focus, but RichFaces won't do any focussing for you.
 
Brajendra Mathema
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tim,

Thanks for the reply.

I have one more question.

In above case, if i re-render the main panel with the button click in the popup which also closes the popup panel, should not the button1 click render popup panel again with focus in first tab.

I've found that when the switch type is 'ajax' and the main panel is rerendered , the first tab is in focus, but to go to next tab i need two click.



Thanks
 
Tim Holloway
Saloon Keeper
Posts: 26057
186
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That sounds like a browser issue. The first click is usually just to get the focus in the browser window itself and the second one is the one that actually gets seen by the tab control.
 
Always! Wait. Never. Shut up. Look at this tiny ad.
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic