[richfaces-issues] [JBoss JIRA] Created: (RF-3674) Cannot prevent node selection in rich:tree via onselected

Bjoern Eickvonder (JIRA) jira-events at lists.jboss.org
Wed Jun 11 05:08:25 EDT 2008


Cannot prevent node selection in rich:tree via onselected
---------------------------------------------------------

                 Key: RF-3674
                 URL: http://jira.jboss.com/jira/browse/RF-3674
             Project: RichFaces
          Issue Type: Bug
    Affects Versions: 3.2.1
            Reporter: Bjoern Eickvonder


Since RF 3.2.1 it is longer possible to prevent node selection by setting "onselected='return false;'".
To be more precise if a node A is selected and the user tries to select a node B whose onselected method returns false, node A is toggled, then node B and again node A (see tree.js and tree-item.js). So far it works, the problem is that the selectedTextClassNames of B are not reset, such that visually A and B seem to be selected afterwards.

Reason for this is that selectedTextClassNames are added to previousTextClassNames on selection but not removed from this string on deselect, such that if the user moves out from the node B appears to be selected as well.

This could be fixed quite simple by adjusting the deselect method in tree-item.js as follows:

deselect: function() {
  var eText = this.elements.textElement;
  if (this.selectedTextClassNames) {
    var classNames = this.selectedTextClassNames.split(' ')
    for (var i = 0; i < classNames.length; i++) {
      Element.removeClassName(eText, classNames[i]);
    }
    if (this.previousTextClassNames && this.previousTextClassNames.indexOf(this.selectedTextClassNames)!=-1) {
      this.previousTextClassNames = this.previousTextClassNames.substring(0,this.previousTextClassNames.indexOf(this.selectedTextClassNames));
    }
  }
}, 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the richfaces-issues mailing list