jsr372-experts@javaserverfaces-spec-public.java.net

[jsr372-experts] Re: [jsr372-experts mirror] Re: Handling focus after an Ajax update

From: Thomas Andraschko <andraschko.thomas_at_gmail.com>
Date: Thu, 2 Apr 2015 10:31:04 +0200

Hi,

in PrimeFaces we do the following:
- remember the current activeElement id before processing the changes node
/ replacing or adding elements to the DOM
- replace/add DOM elements
- re-focus last active element

I'm not sure if it's the perfect solution but it works fine for simple
cases. It might not work when you replace inputs, which are completely new
and has different ids.

Regards,
Thomas

2015-04-02 10:18 GMT+02:00 arjan tijms <arjan.tijms_at_gmail.com>:

> Hi,
>
> On Thursday, April 2, 2015, Kito Mann <kito.mann_at_virtua.com> wrote:
>
>> Am I really the only one with an opinion on this?
>>
>
> As an application developer I can indeed confirm this is an issue.
> JavaScript/DOM stuff is however not my expertise, so I wouldn't be the best
> candidate on the EG to propose a solution for this, unfortunately.
>
> Kind regards,
> Arjan Tijms
>
>
>>
>> ___
>>
>> Kito D. Mann | @kito99 | Author, JSF in Action
>> Virtua, Inc. | http://www.virtua.com | JSF/Java EE training and
>> consulting
>> http://www.JSFCentral.com | @jsfcentral
>> +1 203-998-0403
>>
>> * Listen to the Enterprise Java Newscast: *http://
>> <http://blogs.jsfcentral.com/JSFNewscast/>enterprisejavanews.com
>> <http://ww.enterprisejavanews.com>*
>> * JSFCentral Interviews Podcast:
>> http://www.jsfcentral.com/resources/jsfcentralpodcasts/
>> * Sign up for the JSFCentral Newsletter:
>> http://oi.vresp.com/?fid=ac048d0e17
>>
>> On Thu, Mar 19, 2015 at 10:20 AM, Kito Mann <kito.mann_at_virtua.com> wrote:
>>
>>> Hello everyone,
>>>
>>> One of the annoying things about Ajax updates with JSF is the fact that
>>> focus can easily get lost. One of my clients actually resorted to
>>> synchronous "Ajax" requests to avoid this problem (to my chagrin). Here's a
>>> good description/solution to the problem:
>>> http://www.knitelius.com/2014/07/15/keeping-focus-on-element-with-jsf-2-ajax-render/
>>> .
>>>
>>> Given that this is a common pain point, shouldn't we provide a solution
>>> out of the box?
>>> ___
>>>
>>> Kito D. Mann | @kito99 | Author, JSF in Action
>>> Virtua, Inc. | http://www.virtua.com | JSF/Java EE training and
>>> consulting
>>> http://www.JSFCentral.com | @jsfcentral
>>> +1 203-998-0403
>>>
>>> * Listen to the Enterprise Java Newscast: *http://
>>> <http://blogs.jsfcentral.com/JSFNewscast/>enterprisejavanews.com
>>> <http://ww.enterprisejavanews.com>*
>>> * JSFCentral Interviews Podcast:
>>> http://www.jsfcentral.com/resources/jsfcentralpodcasts/
>>> * Sign up for the JSFCentral Newsletter:
>>> http://oi.vresp.com/?fid=ac048d0e17
>>>
>>
>>