Hi Matthias, thank you for your answer. I have tried to add the DOM replacement listener but it wasn't invoked in my case. It seems to be a difference between a simple partial submit and a partial submit with a resulting refresh of the page (because of the navigation rule). I have also added a tr:selectManyListbox with autoSubmit="true". When I click on an item of the listbox the DOM replacment listener is invoked. So theoretically it should work...
Regards, Sven > JETZT ANMELDEN: SunGard FINANZ-TAG 2008 . www.sungard.de/finanztag Complexity, Compliance & Cost: Globale Herausforderungen und lokale Lösungen 22. Oktober 2008 . Frankfurt am Main _______________________________ Think before you print CONFIDENTIALITY: This e-mail (including any attachments) may contain confidential, proprietary and privileged information, and unauthorized disclosure or use is prohibited. If you receive this e-mail in error, please notify the sender and delete this e-mail from your system. SunGard Systeme GmbH Registered Frankfurt am Main, Handelsregister Frankfurt HRB 56839 Geschäftsführer Harold Finders, Thorsten Junike, Dr. Dirk Lüth, Michael Joseph Ruane, Victoria Elizabeth Silbey -----Ursprüngliche Nachricht----- > Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im > Auftrag von Matthias Wessendorf > Gesendet: Mittwoch, 13. August 2008 11:34 > An: MyFaces Discussion > Betreff: Re: [Trinidad] set focus after partial submit > > Sven, > > we have a dom-update-listener. From the Trinidad DevGuide ([1]). > > Trinidad also lets you get notified when DOM is replaced > after an AJAX response by adding a "DOM replace listener" on the page: > > function myCallback(oldDom, newDom) { ... } > > TrPage.getInstance().addDomReplaceListener(myCallback); > > The callback is passed two parameters: the old DOM element > and the new DOM element that is replacing it. This callback > is invoked after the replacement has happened. As with > addStateChangeListener(), a second argument can be passed if > you need a "this" to be active when your callback is notified. > > > So, when the ppr was handled by the Trinidad client engine > and the dom is replaced. you could "search" for an element, > and call "element.focus()". > Can you try that ? > > -Matthias > > [1] http://myfaces.apache.org/trinidad/devguide/ppr.html > > On Wed, Aug 13, 2008 at 11:28 AM, Rottstock, Sven > <[EMAIL PROTECTED]> wrote: > > I think I have figured out my issue but I don't know how I > can fix it. > > The problem is the action method. It returns an existing > navigation-rule so that the page is completely refreshed > after the partial submit is done. This is necessary because > the table could be changed (regarding of the column count). > > > > Regards, > > > > Sven > > > >> > > JETZT ANMELDEN: SunGard FINANZ-TAG 2008 . www.sungard.de/finanztag > > Complexity, Compliance & Cost: Globale Herausforderungen und lokale > > Lösungen 22. Oktober 2008 . Frankfurt am Main > > > > _______________________________ > > Think before you print > > CONFIDENTIALITY: This e-mail (including any attachments) > may contain confidential, proprietary and privileged > information, and unauthorized disclosure or use is > prohibited. If you receive this e-mail in error, please > notify the sender and delete this e-mail from your system. > > > > SunGard Systeme GmbH Registered Frankfurt am Main, Handelsregister > > Frankfurt HRB 56839 Geschäftsführer Harold Finders, > Thorsten Junike, > > Dr. Dirk Lüth, Michael Joseph Ruane, Victoria Elizabeth Silbey > > > > -----Ursprüngliche Nachricht----- > >> Von: Rottstock, Sven [mailto:[EMAIL PROTECTED] > >> Gesendet: Mittwoch, 13. August 2008 10:26 > >> An: MyFaces Discussion > >> Betreff: [Trinidad] set focus after partial submit > >> > >> Hi, > >> > >> i have the following JavaScript code that should execute a partial > >> submit. After the response is completed the focus should be set on > >> the input element that have triggered the request. > >> > >> <tr:inputText label="#{bundle.searchPattern}" > >> value="#{myBean.searchPattern}" > >> onkeyup="clickButton_afterEnter(event, submitBtn, this);" /> > >> > >> <tr:commandButton id="submitSearch" > action="#{myBean.executeSearch}" > >> text="#{bundle.search}" partialSubmit="true" /> > >> > >> <tr:table partialTriggers="submitSearch" > value="#{myBean.tableData}"> > >> <!-- my columns goes here --> > >> </tr:table> > >> > >> <script type="text/javascript" language="javascript"> > >> // <![CDATA[ > >> var submitBtn = window.document.getElementById("submitSearch"); > >> var lastFocusElem = null; > >> > >> function setFocus(state) > >> { > >> if(state != TrRequestQueue.STATE_BUSY) > >> { > >> if(lastFocusElem != null) > >> { > >> lastFocusElem.focus(); > >> lastFocusElem = null; > >> } > >> > >> TrPage.getInstance().getRequestQueue().removeStateChangeListen > >> er(setFocu > >> s); > >> } > >> } > >> > >> function clickButton_afterEnter(evt, button, source) > >> { > >> evt = (evt) ? evt : (window.event) ? window.event : ""; > >> var keycode = evt.which ? evt.which : (evt.keyCode) ? > >> evt.keyCode > >> : window.event.keyCode; > >> if(keycode == 13) > >> { > >> var btn = (button == null) ? submitBtn : button; > >> var form = document.forms[0]; > >> if(btn != null && form != null) > >> { > >> lastFocusElem = source; > >> > >> TrPage.getInstance().getRequestQueue().addStateChangeListener( > >> setFocus); > >> TrPage._autoSubmit(form.id, btn.id, evt, true, 0); > >> } > >> } > >> } > >> // ]]> > >> </script> > >> > >> Unfortunately the focus is lost from the input field if I have > >> pressed the enter key and the response was completed. > >> Does anybody have an idea what is going wrong here? > >> > >> Regards, > >> > >> Sven > >> > >> JETZT ANMELDEN: SunGard FINANZ-TAG 2008 . > >> www.sungard.de/finanztag Complexity, Compliance & Cost: > >> Globale Herausforderungen und lokale Losungen 22. Oktober > >> 2008 . Frankfurt am Main > >> > >> _______________________________ > >> Think before you print > >> CONFIDENTIALITY: This e-mail (including any attachments) > may contain > >> confidential, proprietary and privileged information, and > >> unauthorized disclosure or use is prohibited. If you receive this > >> e-mail in error, please notify the sender and delete this > e-mail from > >> your system. > >> > >> SunGard Systeme GmbH Registered Frankfurt am Main, > Handelsregister > >> Frankfurt HRB 56839 Geschaftsfuhrer Harold Finders, > Thorsten Junike, > >> Dr. Dirk Luth, Michael Joseph Ruane, Victoria Elizabeth Silbey > >> > >> > >> > > > > > > > > -- > Matthias Wessendorf > > Need JSF and Web 2.0? > http://code.google.com/p/facesgoodies > > further stuff: > blog: http://matthiaswessendorf.wordpress.com/ > sessions: http://www.slideshare.net/mwessendorf > mail: matzew-at-apache-dot-org >

