1 2 Previous Next 22 Replies Latest reply on Dec 1, 2008 12:45 PM by Nick Belaevski

    Problem with expanding rich:tree after ajax rerender

    Stefan Batory Newbie

      Here is an example:

      <h:selectBooleanCheckbox value="#{ctrl}">
       <a4j:support event="onclick" reRender="treePanel"/>
      </h:selectBooleanCheckbox>
      
      <a4j:outputPanel id="treePanel">
       <h:panelGroup rendered="#{ctrl}">
       <rich:tree id="documentsTree">
       <rich:recursiveTreeNodesAdaptor roots="#{rootNodesList}" nodes="#{node.children}" var="node">
       <rich:treeNode>
       ...
       </rich:treeNode>
       </rich:recursiveTreeNodesAdaptor>
       </rich:tree>
       </h:panelGroup>
      </a4j:outputPanel>


      After the click on the checkbox the tree appeared but nodes not expanding. What can I do?

        • 1. Re: Problem with expanding rich:tree after ajax rerender
          Stefan Batory Newbie

          I have installed last version of Seam (2.1.0.SP1) with Richfaces 3.2.2GA and this problem still exists. Can anyone tell me what can I do?

          • 2. Re: Problem with expanding rich:tree after ajax rerender
            Ilya Shaikovsky Master

            please add phaseTracker to your application and paste its log for tree expanding request.

            • 3. Re: Problem with expanding rich:tree after ajax rerender
              Stefan Batory Newbie

              This phaseTracker http://www.jsftutorials.net/faces-config/phaseTracker.html ?

              Here is:

              13:23:28,968 ERROR [STDERR] 2008-11-13 13:23:28 org.exadel.jsf.PhaseTracker beforePhase
              INFO: BEFORE RESTORE_VIEW 1
              13:23:28,984 ERROR [STDERR] 2008-11-13 13:23:28 org.exadel.jsf.PhaseTracker afterPhase
              INFO: AFTER RESTORE_VIEW 1
              13:23:28,984 ERROR [STDERR] 2008-11-13 13:23:28 org.exadel.jsf.PhaseTracker beforePhase
              INFO: BEFORE APPLY_REQUEST_VALUES 2
              13:23:28,984 INFO [STDOUT] Hibernate: select ...
              13:23:29,000 ERROR [STDERR] 2008-11-13 13:23:28 org.exadel.jsf.PhaseTracker afterPhase
              INFO: AFTER APPLY_REQUEST_VALUES 2
              13:23:29,000 ERROR [STDERR] 2008-11-13 13:23:29 org.exadel.jsf.PhaseTracker beforePhase
              INFO: BEFORE PROCESS_VALIDATIONS 3
              13:23:29,000 ERROR [STDERR] 2008-11-13 13:23:29 org.exadel.jsf.PhaseTracker afterPhase
              INFO: AFTER PROCESS_VALIDATIONS 3
              13:23:29,000 ERROR [STDERR] 2008-11-13 13:23:29 org.exadel.jsf.PhaseTracker beforePhase
              INFO: BEFORE UPDATE_MODEL_VALUES 4
              13:23:29,000 ERROR [STDERR] 2008-11-13 13:23:29 org.exadel.jsf.PhaseTracker afterPhase
              INFO: AFTER UPDATE_MODEL_VALUES 4
              13:23:29,000 ERROR [STDERR] 2008-11-13 13:23:29 org.exadel.jsf.PhaseTracker beforePhase
              INFO: BEFORE INVOKE_APPLICATION 5
              13:23:29,000 ERROR [STDERR] 2008-11-13 13:23:29 org.exadel.jsf.PhaseTracker afterPhase
              INFO: AFTER INVOKE_APPLICATION 5
              13:23:29,015 ERROR [STDERR] 2008-11-13 13:23:29 org.exadel.jsf.PhaseTracker beforePhase
              INFO: BEFORE RENDER_RESPONSE 6
              13:23:29,093 ERROR [STDERR] 2008-11-13 13:23:29 org.exadel.jsf.PhaseTracker afterPhase
              INFO: AFTER RENDER_RESPONSE 6


              If the tree is visible when a page is opening then working fine. Here is a log:
              13:25:38,375 ERROR [STDERR] 2008-11-13 13:25:38 org.exadel.jsf.PhaseTracker beforePhase
              INFO: BEFORE RESTORE_VIEW 1
              13:25:38,375 ERROR [STDERR] 2008-11-13 13:25:38 org.exadel.jsf.PhaseTracker afterPhase
              INFO: AFTER RESTORE_VIEW 1
              13:25:38,375 ERROR [STDERR] 2008-11-13 13:25:38 org.exadel.jsf.PhaseTracker beforePhase
              INFO: BEFORE APPLY_REQUEST_VALUES 2
              13:25:38,390 INFO [STDOUT] Hibernate: select ...
              13:25:38,437 ERROR [STDERR] 2008-11-13 13:25:38 org.exadel.jsf.PhaseTracker afterPhase
              INFO: AFTER APPLY_REQUEST_VALUES 2
              13:25:38,437 ERROR [STDERR] 2008-11-13 13:25:38 org.exadel.jsf.PhaseTracker beforePhase
              INFO: BEFORE PROCESS_VALIDATIONS 3
              13:25:38,437 ERROR [STDERR] 2008-11-13 13:25:38 org.exadel.jsf.PhaseTracker afterPhase
              INFO: AFTER PROCESS_VALIDATIONS 3
              13:25:38,437 ERROR [STDERR] 2008-11-13 13:25:38 org.exadel.jsf.PhaseTracker beforePhase
              INFO: BEFORE UPDATE_MODEL_VALUES 4
              13:25:38,437 ERROR [STDERR] 2008-11-13 13:25:38 org.exadel.jsf.PhaseTracker afterPhase
              INFO: AFTER UPDATE_MODEL_VALUES 4
              13:25:38,437 ERROR [STDERR] 2008-11-13 13:25:38 org.exadel.jsf.PhaseTracker beforePhase
              INFO: BEFORE INVOKE_APPLICATION 5
              13:25:38,453 ERROR [STDERR] 2008-11-13 13:25:38 org.exadel.jsf.PhaseTracker afterPhase
              INFO: AFTER INVOKE_APPLICATION 5
              13:25:38,453 ERROR [STDERR] 2008-11-13 13:25:38 org.exadel.jsf.PhaseTracker beforePhase
              INFO: BEFORE RENDER_RESPONSE 6
              13:25:38,687 INFO [STDOUT] Hibernate: select ...
              13:25:38,718 INFO [STDOUT] Hibernate: select ...
              13:25:38,750 ERROR [STDERR] 2008-11-13 13:25:38 org.exadel.jsf.PhaseTracker afterPhase
              INFO: AFTER RENDER_RESPONSE 6


              • 4. Re: Problem with expanding rich:tree after ajax rerender
                Nick Belaevski Master

                Hi,

                That can happen if #{ctrl} is located in request scope. Is it so?

                • 5. Re: Problem with expanding rich:tree after ajax rerender
                  Stefan Batory Newbie

                  #{ctrl} only controlling visibility of the Tree. This is example only. I need to show the Tree after some ajax event. It doesn't working even if I replace #{ctrl} by #{someBean.isTreeVisible}.

                  • 6. Re: Problem with expanding rich:tree after ajax rerender
                    Ilya Shaikovsky Master

                    but this is not an answer on Nick's question?..

                    • 7. Re: Problem with expanding rich:tree after ajax rerender
                      Stefan Batory Newbie

                      Sorry. Yes. #{ctrl} is in request scope but if I use #{sessionScopeBean.flag} the Tree is not working too.

                      • 8. Re: Problem with expanding rich:tree after ajax rerender
                        Nick Belaevski Master

                        I cannot reproduce the issue. Please add

                        <a4j:log popup="false" />
                        to the page, try to open the tree, and paste log here

                        • 9. Re: Problem with expanding rich:tree after ajax rerender
                          Denis Marzadro Novice

                          write just to let you know I have the same problem with a radio button.
                          Using ajax change mode it display correctly the tree but then the tree doesn't work.

                          I think is important to know:
                          - env: richfaces 3.2.2GA, tomcat 6, JSF RI 1.2 (and rich 3.1.4 jsf ri 1.1)
                          - it happens only with IE7 (with FF3 it works right and with other browser version i didn't try)
                          - with IE7 at when tree is shown the browser advise about a javascript error (not happens with FF3)
                          - if after tree is displayed i make F5 to refresh the window, then after that the tree works perfectly

                          Hope it can help to find the problem
                          Greetings

                          • 10. Re: Problem with expanding rich:tree after ajax rerender
                            Ilya Shaikovsky Master

                            please provide the log asked by Nick.

                            • 11. Re: Problem with expanding rich:tree after ajax rerender
                              Stefan Batory Newbie

                              After click on the checkbox:

                              debug[20:36:09,732]: Have Event [object Object] with properties: target: [object HTMLInputElement], srcElement: undefined, type: click
                              debug[20:36:09,732]: NEW AJAX REQUEST !!! with form :j_id15
                              debug[20:36:09,733]: Append hidden control j_id15 with value [j_id15] and value attribute [j_id15]
                              debug[20:36:09,733]: Append hidden control javax.faces.ViewState with value [j_id4] and value attribute [j_id4]
                              debug[20:36:09,734]: parameter ajaxSingle with value j_id15:j_id18
                              debug[20:36:09,734]: parameter j_id15:j_id19 with value j_id15:j_id19
                              debug[20:36:09,735]: Start XmlHttpRequest
                              debug[20:36:09,736]: Reqest state : 1
                              debug[20:36:09,736]: QueryString: AJAXREQUEST=_viewRoot&j_id15=j_id15&javax.faces.ViewState=j_id4&j_id15%3Aj_id18=on&ajaxSingle=j_id15%3Aj_id18&j_id15%3Aj_id19=j_id15%3Aj_id19&
                              debug[20:36:09,737]: Reqest state : 1
                              debug[20:36:09,804]: Reqest state : 2
                              debug[20:36:09,806]: Reqest state : 3
                              debug[20:36:09,806]: Reqest state : 3
                              debug[20:36:09,806]: Reqest state : 4
                              debug[20:36:09,807]: Reqest end with state 4
                              debug[20:36:09,807]: Response with content-type: text/xml;charset=UTF-8
                              debug[20:36:09,807]: Full response content: <?xml version="1.0"?> <html xmlns="http://www.w3.org/1999/xhtml"><head><title></title><link href="/testproject/a4j/s/3_2_2.GAstylesheet/theme.xcss/DATB/eAFrvajdHLp8hjQAEgwDtA__" type="text/css" rel="stylesheet" class="user" /><link href="/testproject/stylesheet/theme.css" type="text/css" rel="stylesheet" class="user" /></head><body><span id="j_id15:treePanel"><div class="dr-tree rich-tree" id="j_id15:j_id22" xmlns:rich="http://richfaces.ajax4jsf.org/rich"><div id="j_id15:j_id22:childs"><p class="dr-tree-last-node-marker"></p><table border="0" cellpadding="0" cellspacing="0" class="dr-tree-full-width rich-tree-node" id="j_id15:j_id22:j__id23:0::j_id24"><tbody><tr id="j_id15:j_id22:j__id23:0::j_id24:mainRow" onclick=""><td class="dr-tree-h-ic rich-tree-node-handleicon dr-tree-h-ic-line-last" id="j_id15:j_id22:j__id23:0::j_id24:handles"><div><a href="#" id="j_id15:j_id22:j__id23:0::j_id24:handle" onclick="Tree.Item.fireExpansionEvent(this);;A4J.AJAX.Submit('_viewRoot','j_id15',event,{'parameters':{'j_id15:j_id22:j__id23:0::j_id24AjaxExpanded':true,'j_id15:j_id22:j__id23:0::j_id24NodeExpanded':'true'} ,'actionUrl':'/testproject/home.seam'} ); return false;"><img border="0" class="dr-tree-pointer-cursor dr-tree-h-ic-img-md dr-tree-h-ic-img rich-tree-node-handleicon-collapsed" id="j_id15:j_id22:j__id23:0::j_id24:handle:img:collapsed" src="/testproject/a4j/g/3_2_2.GAorg.richfaces.renderkit.html.images.TreePlusImage/DATB/eAH7!!!!q2vHGBgYACSzBYQ_" /><img border="0" class="dr-tree-pointer-cursor dr-tree-h-ic-img-md dr-tree-h-ic-img rich-tree-node-handleicon-expanded" id="j_id15:j_id22:j__id23:0::j_id24:handle:img:expanded" src="/testproject/a4j/g/3_2_2.GAorg.richfaces.renderkit.html.images.TreeMinusImage/DATB/eAH7!!!!q2vHGBgYACSzBYQ_" style="display: none;" /></a></div></td><td class="dr-tree-h-ic rich-tree-node-icon dr-tree-h-ic-line-clp" id="j_id15:j_id22:j__id23:0::j_id24:icon" rich:draggableoptions="{'parameters':{'dragSourceId':'j_id15:j_id22:j__id23:0::j_id24','j_id15:j_id22:j__id23:0::j_id24':'j_id15:j_id22:j__id23:0::j_id24'} }" rich:dropzoneoptions="{}"><img class="dr-tree-h-ic-img-md dr-tree-h-ic-img" src="/testproject/a4j/g/3_2_2.GAimages/iconFolder.gif" /></td><td class="dr-tree-h-text rich-tree-node-text" id="j_id15:j_id22:j__id23:0::j_id24:text" rich:highlightedclass="dr-tree-i-hl rich-tree-node-highlighted" rich:selectedclass="dr-tree-i-sel rich-tree-node-selected">root</td></tr></tbody></table><div id="j_id15:j_id22:j__id23:0::j_id24:childs" style="display: none;" class="dr-tree-layout-on dr-tree-h-ic-div rich-tree-node-children rich-tree-node-cildren"></div></div><input type="hidden" id="j_id15:j_id22:input" name="j_id15:j_id22:input" value="" /><script type="text/javascript">//<![CDATA[ var Richfaces_Tree_j_id15_j_id22 = new Tree("j_id15:j_id22", "j_id15:j_id22:input", "ajax", { onselect: "", onexpand: "", oncollapse: "" }, function(event) { A4J.AJAX.Submit('_viewRoot','j_id15',event,{'parameters':{'j_id15:j_id22:selectedNode':event.selectedNode} ,'actionUrl':'/testproject/home.seam'} ); return false; }, false, true ); Richfaces_Tree_j_id15_j_id22.drop = function(event,drag){var options = {'parameters':{'j_id15:j_id22':'j_id15:j_id22'} ,'actionUrl':'/testproject/home.seam'} ;options.parameters['dropTargetId'] = 'j_id15:j_id22';Object.extend(options.parameters,drag.getParameters());var dzOptions = this.getDropzoneOptions(); if (dzOptions.ondrop) { if (!dzOptions.ondrop.call(this, event)) return; };A4J.AJAX.Submit('_viewRoot','j_id15',event,options);}; //]]> </script><div class="dr-tree-h-script" id="j_id15:j_id22:script"><script type="text/javascript"> </script></div></div></span><meta name="Ajax-Update-Ids" content="j_id15:treePanel" /><span id="ajax-view-state"><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="j_id4" /></span><meta id="Ajax-Response" name="Ajax-Response" content="true" /></body></html>
                              debug[20:36:09,809]: Header Ajax-Expired not found, search in <meta>
                              debug[20:36:09,809]: search for elements by name 'meta' in element #document
                              debug[20:36:09,810]: Find <meta name='Ajax-Update-Ids' content='j_id15:treePanel'>
                              debug[20:36:09,810]: Find <meta name='Ajax-Response' content='true'>
                              debug[20:36:09,811]: Header Ajax-Update-Ids not found, search in <meta>
                              debug[20:36:09,811]: search for elements by name 'meta' in element #document
                              debug[20:36:09,811]: Find <meta name='Ajax-Update-Ids' content='j_id15:treePanel'>
                              debug[20:36:09,812]: Update page by list of rendered areas from response j_id15:treePanel
                              debug[20:36:09,812]: search for elements by name 'script' in element #document
                              debug[20:36:09,813]: search for elements by name 'link' in element #document
                              debug[20:36:09,813]: <link> in response with src=/testproject/a4j/s/3_2_2.GAstylesheet/theme.xcss/DATB/eAFrvajdHLp8hjQAEgwDtA__
                              debug[20:36:09,813]: Such element exist in document
                              debug[20:36:09,814]: <link> in response with src=/testproject/stylesheet/theme.css
                              debug[20:36:09,814]: Such element exist in document
                              debug[20:36:09,814]: Update page part from call parameter for ID j_id15:treePanel
                              debug[20:36:09,815]: call getElementById for id= j_id15:treePanel
                              debug[20:36:09,817]: Replace content of node by replaceChild()
                              debug[20:36:09,818]: search for elements by name 'script' in element span
                              debug[20:36:09,819]: Scripts in updated part count : 2
                              debug[20:36:09,819]: Update part of page for Id: j_id15:treePanel successful
                              debug[20:36:09,820]: call getElementById for id= ajax-view-state
                              debug[20:36:09,820]: Hidden JSF state fields: [object HTMLSpanElement]
                              debug[20:36:09,820]: Namespace for hidden view-state input fields is undefined
                              debug[20:36:09,821]: search for elements by name 'input' in element span
                              debug[20:36:09,821]: Replace value for inputs: 4 by new values: 1
                              debug[20:36:09,822]: Input in response: javax.faces.ViewState
                              debug[20:36:09,823]: Found same input on page with type: hidden
                              debug[20:36:09,823]: search for elements by name 'INPUT' in element span
                              debug[20:36:09,824]: Replace value for inputs: 4 by new values: 0
                              debug[20:36:09,824]: call getElementById for id= _A4J.AJAX.focus
                              debug[20:36:09,824]: No focus information in response
                              debug[20:36:09,835]: Evaluate script replaced area in document: // var Richfaces_Tree_j_id15_j_id22 = new Tree("j_id15:j_id22", "j_id15:j_id22:input", "ajax", { onselect: "", onexpand: "", oncollapse: "" }, function(event) { A4J.AJAX.Submit('_viewRoot','j_id15',event,{'parameters':{'j_id15:j_id22:selectedNode':event.selectedNode} ,'actionUrl':'/testproject/home.seam'} ); return false; }, false, true ); Richfaces_Tree_j_id15_j_id22.drop = function(event,drag){var options = {'parameters':{'j_id15:j_id22':'j_id15:j_id22'} ,'actionUrl':'/testproject/home.seam'} ;options.parameters['dropTargetId'] = 'j_id15:j_id22';Object.extend(options.parameters,drag.getParameters());var dzOptions = this.getDropzoneOptions(); if (dzOptions.ondrop) { if (!dzOptions.ondrop.call(this, event)) return; };A4J.AJAX.Submit('_viewRoot','j_id15',event,options);}; //
                              debug[20:36:09,838]: Evaluate script replaced area in document:
                              debug[20:36:09,839]: call getElementById for id= org.ajax4jsf.oncomplete


                              And after click on the tree switch:

                              debug[20:36:46,468]: Have Event [object Object] with properties: target: undefined, srcElement: [object], type: click
                              debug[20:36:46,468]: NEW AJAX REQUEST !!! with form :j_id15
                              debug[20:36:46,468]: Append hidden control j_id15 with value [j_id15] and value attribute [j_id15]
                              debug[20:36:46,468]: Append hidden control j_id15:j_id22:input with value [] and value attribute []
                              debug[20:36:46,468]: Append hidden control javax.faces.ViewState with value [j_id5] and value attribute [j_id5]
                              debug[20:36:46,468]: parameter j_id15:j_id22:j__id23:0::j_id24AjaxExpanded with value true
                              debug[20:36:46,468]: parameter j_id15:j_id22:j__id23:0::j_id24NodeExpanded with value true
                              debug[20:36:46,468]: Start XmlHttpRequest
                              debug[20:36:46,468]: Reqest state : 1
                              debug[20:36:46,484]: QueryString: AJAXREQUEST=_viewRoot&j_id15=j_id15&j_id15%3Aj_id18=on&j_id15%3Aj_id22%3Ainput=&javax.faces.ViewState=j_id5&j_id15%3Aj_id22%3Aj__id23%3A0%3A%3Aj_id24AjaxExpanded=true&j_id15%3Aj_id22%3Aj__id23%3A0%3A%3Aj_id24NodeExpanded=true&
                              debug[20:36:46,656]: Reqest state : 2
                              debug[20:36:46,656]: Reqest state : 3
                              debug[20:36:46,656]: Reqest state : 4
                              debug[20:36:46,656]: Reqest end with state 4
                              debug[20:36:46,656]: Response with content-type: text/xml;charset=UTF-8
                              debug[20:36:46,656]: Full response content: <?xml version="1.0"?>
                              <html xmlns="http://www.w3.org/1999/xhtml"><head><title></title><link href="/testproject/a4j/s/3_2_2.GAstylesheet/theme.xcss/DATB/eAFrvajdHLp8hjQAEgwDtA__" type="text/css" rel="stylesheet" class="user" /><link href="/testproject/stylesheet/theme.css" type="text/css" rel="stylesheet" class="user" /></head><body><div xmlns:rich="http://richfaces.ajax4jsf.org/rich"></div><meta name="Ajax-Update-Ids" content="" /><span id="ajax-view-state"><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="j_id5" /></span><meta id="Ajax-Response" name="Ajax-Response" content="true" /></body></html>
                              debug[20:36:46,656]: Header Ajax-Expired not found, search in <meta>
                              debug[20:36:46,656]: search for elements by name 'meta' in element #document
                              debug[20:36:46,656]: Find <meta name='Ajax-Update-Ids' content=''>
                              debug[20:36:46,656]: Find <meta name='Ajax-Response' content='true'>
                              debug[20:36:46,656]: Header Ajax-Update-Ids not found, search in <meta>
                              debug[20:36:46,656]: search for elements by name 'meta' in element #document
                              debug[20:36:46,671]: Find <meta name='Ajax-Update-Ids' content=''>
                              warn[20:36:46,671]: No information in response about elements to replace
                              debug[20:36:46,671]: call selectSingleNode for id= org.ajax4jsf.oncomplete
                              debug[20:36:46,671]: call selectSingleNode for id= ajax-view-state
                              debug[20:36:46,671]: Hidden JSF state fields:
                              debug[20:36:46,671]: Namespace for hidden view-state input fields is undefined
                              debug[20:36:46,671]: search for elements by name 'input' in element span
                              debug[20:36:46,671]: Replace value for inputs: 4 by new values: 1
                              debug[20:36:46,671]: Input in response: javax.faces.ViewState
                              debug[20:36:46,671]: Found same input on page with type: hidden
                              debug[20:36:46,671]: search for elements by name 'INPUT' in element span
                              debug[20:36:46,671]: Replace value for inputs: 4 by new values: 0
                              debug[20:36:46,671]: call selectSingleNode for id= _A4J.AJAX.focus
                              debug[20:36:46,687]: No focus information in response


                              Here is a simple project generated with seam-gen (without libraries): http://pietruha.serveftp.net/down/testproject.zip

                              • 12. Re: Problem with expanding rich:tree after ajax rerender
                                Aleksandr Dubovsky Newbie

                                Hello, pietruha

                                Please create a ready to run on server EAR file with all needed libs and sent it on my email (or provide link as in previous post).

                                1 2 Previous Next