[richfaces-issues] [JBoss JIRA] Issue Comment Edited: (RF-10948) component select: instable behaviour in conjunction with a standard jsf-tag ajax (event selectitem, probably more)

Brian Leathem (JIRA) jira-events at lists.jboss.org
Tue Aug 23 19:37:18 EDT 2011


    [ https://issues.jboss.org/browse/RF-10948?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12604911#comment-12604911 ] 

Brian Leathem edited comment on RF-10948 at 8/23/11 7:35 PM:
-------------------------------------------------------------

Jay,

- ... Also can you reproduce if you use a4j:ajax? Yes, I can reproduce it if I use the RichFaces tag a4j:ajax
- ... Can you produce across browsers? Yes, I can produce it across browsers. The problem was reproduced by using the browsers: firefox 4.1, IE8 and chrome 8.

Meanwhile I have already identified the cause of the problem. Namely:
The focus handler implementation may not be comprehensive and should be improved. If the component select does not lose the focus, while various items are selected, it will cause the focus value is not always updated and that is the reason then, why is this AJAX request is not triggered by event 'selectitem' (probably more events). The following code snippet shows from select.js what I mean:

selectitem call:
{code}
if(this.focusValue != this.selValueInput.val() ) { // NOTE only if not equal
    this.invokeEvent.call(this,"selectitem", document.getElementById(this.id));
}
{code}

focus-handler-implementation
{code}
__focusHandler: function(e) {
    if (!this.focused) { NOTE !!!: if you do not lose the focus of the component, what then? The focusValue will not be updated and the event will not be invoked !
	if(this.__getValue() == this.defaultLabel) {
	    this.__setValue("");
	}
        this.focusValue = this.selValueInput.val();
	this.focused = true;
	this.invokeEvent.call(this, "focus", document.getElementById(this.id), e);
    }
},
{code}


      was (Author: serbec):
    Jay,

- ... Also can you reproduce if you use a4j:ajax? Yes, I can reproduce it if I use the RichFaces tag a4j:ajax
- ... Can you produce across browsers? Yes, I can produce it across browsers. The problem was reproduced by using the browsers: firefox 4.1, IE8 and chrome 8.

Meanwhile I have already identified the cause of the problem. Namely:
The focus handler implementation may not be comprehensive and should be improved. If the component select does not lose the focus, while various items are selected, it will cause the focus value is not always updated and that is the reason then, why is this AJAX request is not triggered by event 'selectitem' (probably more events). The following code snippet shows from select.js what I mean:

selectitem call:
if(this.focusValue != this.selValueInput.val() ) { // NOTE only if not equal
    this.invokeEvent.call(this,"selectitem", document.getElementById(this.id));
}

focus-handler-implementation
__focusHandler: function(e) {
    if (!this.focused) { NOTE !!!: if you do not lose the focus of the component, what then? The focusValue will not be updated and the event will not be invoked !
	if(this.__getValue() == this.defaultLabel) {
	    this.__setValue("");
	}
        this.focusValue = this.selValueInput.val();
	this.focused = true;
	this.invokeEvent.call(this, "focus", document.getElementById(this.id), e);
    }
},


  
> component select: instable behaviour in conjunction with a standard jsf-tag ajax (event selectitem, probably more)
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: RF-10948
>                 URL: https://issues.jboss.org/browse/RF-10948
>             Project: RichFaces
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: component-selects
>    Affects Versions: 4.0.0.Final
>         Environment: Webcontainer: Tomcat 6
> JSF 2.0 implementation: mojarra 2.0.4-b9
> Richfaces 4 Final
>            Reporter: Sergej Becker
>            Assignee: Brian Leathem
>             Fix For: 4.1.0.Milestone2
>
>
> The durable usage of the sample below can reproduce an inconsistent behavior of the component 'select' in conjunction with a standard jsf-tag 'ajax':
> on event 'selectitem' (it probably effects more events) the ajax-request doesn't work consistent. Occurs sporadically! It usually affects the first selected value.
> {code}
> <h:form id="formid">
>     <rich:select value="#{...}" label="...">
>         <f:ajax event="selectitem" render=":formid:tableid" />
>         <f:selectItem itemValue="0" itemLabel="0..n" />
>         <f:selectItem itemValue="20" itemLabel="20..n" />
>         <f:selectItem itemValue="40" itemLabel="40..n" />
>     </rich:select>
>     <h:dataTable value="..." id="tableid" var="...">
>         <h:column>
> 	    <h:outputText value="..."/>
> 	</h:column>
> 	<h:column>
> 	    <h:outputText value="..."/>
> 	</h:column>
> 	<h:column>
> 	    <h:outputText value="..."/>
> 	</h:column>
>     </h:dataTable>
> </h:form>
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the richfaces-issues mailing list