7 Replies Latest reply on Mar 26, 2007 11:54 AM by mail.micke

    Rerender datatable fter clicking a4j:commandButton on a row

    mail.micke

      Hi,
      yet another datatable rerender question.

      i have a request scoped bean which contains a list of items displayed in a (RichFaces) datatable. The bean containng items is stored with t:saveState.

      On each row I have a remove item button which, uses updateActionListener to set the id of the item to remove and then calls a removeItem action via a4j:commandButton.
      When debugging i see that items are removed as they should, but the data table isn't rerendered. Know that the correct id is specified in the command buttons reRender attribute.

      Using:
      facelets 1.1.12
      myfaces 1.1.4
      richfaces 3.0.0

      Should this work?

      When wrapping the whole datatable in a a4j:outputPanel ajaxRendered=true the datatable is correctly rerendered.
      But this has the undesired side effect off somehow side stepping vaildations!?! Meaning that each row has an inputText with required=true, which can normally not be left empty when adding a new item, but now it can.


      Many thanks,
      Mike

        • 1. Re: Rerender datatable fter clicking a4j:commandButton on a
          ilya_shaikovsky

          Could you please post there the client log for request when dataTable isn't rerendered?

          • 2. Re: Rerender datatable fter clicking a4j:commandButton on a
            ilya_shaikovsky

            use a4j:log

            • 3. Re: Rerender datatable fter clicking a4j:commandButton on a
              mail.micke

              Hi,
              here is logging output for when clicking the link:

              
              debug[15:29:13,647]: Have Event [object Object] with properties: target: [object HTMLInputElement], srcElement: undefined, type: click
              debug[15:29:13,647]: NEW AJAX REQUEST !!! with form :editRuleForm
              debug[15:29:13,663]: parameter editRuleForm:importList:0:_id56 with value editRuleForm:importList:0:_id56
              debug[15:29:13,663]: Start XmlHttpRequest
              debug[15:29:13,663]: Reqest state : 1
              debug[15:29:13,663]: QueryString: AJAXREQUEST=_viewRoot&editRuleForm%3AredName=Code%20must%20be%20set&editRuleForm%3AredPackage=com.test.ruleengine&editRuleForm%3AredSalience=100&editRuleForm%3AredAgendaGroup=%20&editRuleForm%3AimportList%3A0%3AreiPackage=asdasdasd&editRuleForm%3AimportList%3A1%3AreiPackage=&editRuleForm_SUBMIT=1&autoScroll=&jsf_sequence=1&editRuleForm%3A_link_hidden_=&jsf_tree=_id9%3A_id20&jsf_viewid=%2Frule%2FeditRule.xhtml&editRuleForm%3AimportList%3A0%3A_id56=editRuleForm%3AimportList%3A0%3A_id56&
              debug[15:29:13,663]: Reqest state : 1
              debug[15:29:13,866]: Reqest state : 2
              debug[15:29:13,866]: Reqest state : 3
              debug[15:29:13,866]: Reqest state : 4
              debug[15:29:13,866]: Reqest end with state 4
              debug[15:29:13,866]: Response with content-type: text/xml;charset=UTF-8
              debug[15:29:13,866]: Full response content: <?xml version="1.0" encoding="UTF-8"?><html xmlns="http://www.w3.org/1999/xhtml"><head><link href="/dss/a4j.res/org/richfaces/renderkit/html/css/toolBar.xcss/DATA/eAFbJaehBAADeAET.faces" type="text/css" rel="stylesheet"/><link href="/dss/a4j.res/org/richfaces/renderkit/html/css/panel.xcss/DATA/eAFbJaehBAADeAET.faces" type="text/css" rel="stylesheet"/><link href="/dss/a4j.res/org/richfaces/renderkit/html/css/table.xcss/DATA/eAFbJaehBAADeAET.faces" type="text/css" rel="stylesheet"/><script src="/dss/a4j.res/org.ajax4jsf.framework.ajax.AjaxScript.faces" type="text/javascript"/></head><body><span id="editRuleForm:_id30"/><span id="editRuleForm:_id33"/><span id="editRuleForm:_id36"/><span id="editRuleForm:_id39"/><span id="editRuleForm:_id42"/><span id="editRuleForm:_id45"/><table class="dr-table rich-table " id="editRuleForm:importList:0" border="0" cellpadding="2" cellspacing="0" style="background-color: #f5f5f5" width="700"><colgroup span="2"/><thead><tr class="dr-table-header rich-table-header "><td class="dr-table-headercell rich-table-headercell " id="editRuleForm:importList:_id49">Imports</td><td class="dr-table-headercell rich-table-headercell " id="editRuleForm:importList:_id51">Action</td></tr></thead><tbody><tr class="dr-table-firstrow rich-table-firstrow header_blue"><td class="dr-table-cell rich-table-cell " id="editRuleForm:importList:0:_id54" style="text-align:center"><input id="editRuleForm:importList:0:reiPackage" name="editRuleForm:importList:0:reiPackage" type="text" value="asdasdasd" size="114" class="input"/></td><td class="dr-table-cell rich-table-cell " id="editRuleForm:importList:0:_id55" style="text-align:center"><input id="editRuleForm:importList:0:_id56" name="editRuleForm:importList:0:_id56" onclick="A4J.AJAX.Submit('_viewRoot','editRuleForm',event,{'parameters':{'editRuleForm:importList:0:_id56':'editRuleForm:importList:0:_id56'},'actionUrl':'/dss/rule/editRule.jsf'});return false;" value="Remove Import" class="button_blue_border" style="width:80px" type="button"/></td></tr></tbody></table><span id="editRuleForm:_id59"/><meta name="Ajax-Update-Ids" content="editRuleForm:_id45,editRuleForm:_id36,editRuleForm:importList:0,editRuleForm:_id42,editRuleForm:_id39,editRuleForm:_id33,editRuleForm:_id30,editRuleForm:_id59"/><span id="ajax-update-ids"><input type="hidden" name="jsf_sequence" value="1"/><input type="hidden" name="jsf_tree" id="jsf_tree" value="_id9:_id21"/><input type="hidden" name="jsf_viewid" id="jsf_viewid" value="/rule/editRule.xhtml"/></span><meta id="Ajax-Response" name="Ajax-Response" content="true"/></body></html>
              debug[15:29:13,866]: Update page by list of rendered areas from response editRuleForm:_id45,editRuleForm:_id36,editRuleForm:importList:0,editRuleForm:_id42,editRuleForm:_id39,editRuleForm:_id33,editRuleForm:_id30,editRuleForm:_id59
              debug[15:29:13,866]: search for elements by name 'script' in element #document
              debug[15:29:13,866]: getElementsByTagName found 1
              debug[15:29:13,866]: <script> in response with src=/dss/a4j.res/org.ajax4jsf.framework.ajax.AjaxScript.faces
              debug[15:29:13,866]: Such element exist in document
              debug[15:29:13,866]: search for elements by name 'link' in element #document
              debug[15:29:13,866]: getElementsByTagName found 3
              debug[15:29:13,866]: <link> in response with src=/dss/a4j.res/org/richfaces/renderkit/html/css/toolBar.xcss/DATA/eAFbJaehBAADeAET.faces
              debug[15:29:13,881]: Such element exist in document
              debug[15:29:13,881]: <link> in response with src=/dss/a4j.res/org/richfaces/renderkit/html/css/panel.xcss/DATA/eAFbJaehBAADeAET.faces
              debug[15:29:13,881]: Such element exist in document
              debug[15:29:13,881]: <link> in response with src=/dss/a4j.res/org/richfaces/renderkit/html/css/table.xcss/DATA/eAFbJaehBAADeAET.faces
              debug[15:29:13,881]: Such element exist in document
              debug[15:29:13,881]: Attempt to update part of page for Id: editRuleForm:_id45
              debug[15:29:13,881]: call getElementById for id= editRuleForm:_id45
              debug[15:29:13,881]: Replace content of node by replaceChild()
              debug[15:29:13,881]: search for elements by name 'script' in element span
              debug[15:29:13,881]: getElementsByTagName found 0
              debug[15:29:13,881]: Scripts in updated part count : 0
              debug[15:29:13,881]: Update part of page for Id: editRuleForm:_id45 successful
              debug[15:29:13,881]: Attempt to update part of page for Id: editRuleForm:_id36
              debug[15:29:13,881]: call getElementById for id= editRuleForm:_id36
              debug[15:29:13,881]: Replace content of node by replaceChild()
              debug[15:29:13,897]: search for elements by name 'script' in element span
              debug[15:29:13,897]: getElementsByTagName found 0
              debug[15:29:13,897]: Scripts in updated part count : 0
              debug[15:29:13,897]: Update part of page for Id: editRuleForm:_id36 successful
              debug[15:29:13,897]: Attempt to update part of page for Id: editRuleForm:importList:0
              debug[15:29:13,897]: call getElementById for id= editRuleForm:importList:0
              warn[15:29:13,897]: Node for replace by response with id editRuleForm:importList:0 not found in document
              debug[15:29:13,897]: Attempt to update part of page for Id: editRuleForm:_id42
              debug[15:29:13,897]: call getElementById for id= editRuleForm:_id42
              debug[15:29:13,897]: Replace content of node by replaceChild()
              debug[15:29:13,897]: search for elements by name 'script' in element span
              debug[15:29:13,897]: getElementsByTagName found 0
              debug[15:29:13,897]: Scripts in updated part count : 0
              debug[15:29:13,897]: Update part of page for Id: editRuleForm:_id42 successful
              debug[15:29:13,897]: Attempt to update part of page for Id: editRuleForm:_id39
              debug[15:29:13,897]: call getElementById for id= editRuleForm:_id39
              debug[15:29:13,913]: Replace content of node by replaceChild()
              debug[15:29:13,913]: search for elements by name 'script' in element span
              debug[15:29:13,913]: getElementsByTagName found 0
              debug[15:29:13,913]: Scripts in updated part count : 0
              debug[15:29:13,913]: Update part of page for Id: editRuleForm:_id39 successful
              debug[15:29:13,913]: Attempt to update part of page for Id: editRuleForm:_id33
              debug[15:29:13,928]: call getElementById for id= editRuleForm:_id33
              debug[15:29:13,928]: Replace content of node by replaceChild()
              debug[15:29:13,928]: search for elements by name 'script' in element span
              debug[15:29:13,928]: getElementsByTagName found 0
              debug[15:29:13,928]: Scripts in updated part count : 0
              debug[15:29:13,928]: Update part of page for Id: editRuleForm:_id33 successful
              debug[15:29:13,928]: Attempt to update part of page for Id: editRuleForm:_id30
              debug[15:29:13,928]: call getElementById for id= editRuleForm:_id30
              debug[15:29:13,928]: Replace content of node by replaceChild()
              debug[15:29:13,928]: search for elements by name 'script' in element span
              debug[15:29:13,928]: getElementsByTagName found 0
              debug[15:29:13,928]: Scripts in updated part count : 0
              debug[15:29:13,928]: Update part of page for Id: editRuleForm:_id30 successful
              debug[15:29:13,928]: Attempt to update part of page for Id: editRuleForm:_id59
              debug[15:29:13,928]: call getElementById for id= editRuleForm:_id59
              debug[15:29:13,944]: Replace content of node by replaceChild()
              debug[15:29:13,944]: search for elements by name 'script' in element span
              debug[15:29:13,944]: getElementsByTagName found 0
              debug[15:29:13,944]: Scripts in updated part count : 0
              debug[15:29:13,944]: Update part of page for Id: editRuleForm:_id59 successful
              debug[15:29:13,944]: call getElementById for id= ajax-update-ids
              debug[15:29:13,944]: Hidden JSF state fields: [object HTMLSpanElement]
              debug[15:29:13,944]: search for elements by name 'input' in element span
              debug[15:29:13,944]: getElementsByTagName found 3
              debug[15:29:13,944]: Replace value for inputs: 27 by new values: 3
              debug[15:29:13,944]: Input in response: jsf_sequence
              debug[15:29:13,944]: Found same input on page with type: hidden
              debug[15:29:13,944]: Found same input on page with type: hidden
              debug[15:29:13,960]: Found same input on page with type: hidden
              debug[15:29:13,960]: Input in response: jsf_tree
              debug[15:29:13,960]: Found same input on page with type: hidden
              debug[15:29:13,960]: Found same input on page with type: hidden
              debug[15:29:13,960]: Found same input on page with type: hidden
              debug[15:29:13,960]: Input in response: jsf_viewid
              debug[15:29:13,960]: Found same input on page with type: hidden
              debug[15:29:13,960]: Found same input on page with type: hidden
              debug[15:29:13,960]: Found same input on page with type: hidden
              debug[15:29:13,960]: search for elements by name 'INPUT' in element span
              debug[15:29:13,960]: getElementsByTagName found 0
              debug[15:29:13,975]: Replace value for inputs: 27 by new values: 0
              
              




              • 4. Re: Rerender datatable fter clicking a4j:commandButton on a
                ilya_shaikovsky

                Hm.. I'm able to see that one of the nodes to reRender not found.. seem like it's your list.. may be you may send me your project template without lins directly for simplier investigations?

                • 5. Re: Rerender datatable fter clicking a4j:commandButton on a
                  mail.micke

                  sorry but what does "without lins" mean, that I should send you the page via email?
                  Not a hardcore bb forum user, incase it some slang :)

                  - Mike

                  • 6. Re: Rerender datatable fter clicking a4j:commandButton on a
                    ilya_shaikovsky

                    sorry i wanted to write libs.. :) just configs pages and beans.

                    • 7. Re: Rerender datatable fter clicking a4j:commandButton on a
                      mail.micke

                      Hi,
                      this is a pretty massive and I most likely not allowed to send it anyway :)

                      I'll see if I can create a simple project and reproduce this.

                      Get back to you soon.

                      Cheers,
                      Mike