3 Replies Latest reply on May 14, 2008 4:38 AM by ilya_shaikovsky

    datatable, onRowClick and action are not working well togeth

    bostone

      I'm having problems with firing actions from datatable rows. After searching forums it seems that I'm not the only one. I have pretty (it seems) standard setup but my actionListener method is only executed when an empty row is clicked. If I click on row that has a value, the AJAX request is issued but actionListener method is not executed. I use mock data object that you can see below also

      XHTML

      <rich:scrollableDataTable value="#{deviceMasterFormBean.searchResultModel}"
       var="device" height="150px" width="100%" first="0" rows="10"
       onRowMouseOver="this.style.backgroundColor='#F8F8F8'"
       onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'" rowClasses="cur">
       <rich:column width="150px">
       <f:facet name="header">
       <h:outputText value="Tag" />
       </f:facet>
       <h:outputText value="#{device.tag}" />
       </rich:column>
       <rich:column width="200px">
       <f:facet name="header">
       <h:outputText value="Primary Namespace" />
       </f:facet>
       <h:outputText value="#{device.namespace}" />
       </rich:column>
       <rich:column width="150px">
       <f:facet name="header">
       <h:outputText value="Primary IP" />
       </f:facet>
       <h:outputText value="#{device.ip}" />
       </rich:column>
       <a4j:support event="onRowClick" actionListener="#{deviceMasterFormBean.onSelectSearchResult}"
       ajaxSingle="true" reRender="searchTogglePanel,updateControls,deviceTabs"/>
      </rich:scrollableDataTable>


      Data object
       private ArrayList<Map<String, Object>> mockSearchMap() {
       ArrayList<Map<String, Object>> searchModel = new ArrayList<Map<String, Object>>();
       Map<String, Object> row1 = new HashMap<String, Object>();
       row1.put("id", 1);
       row1.put("tag", "-");
       row1.put("namespace", "zoom.foofoo.foo");
       row1.put("ip", "123.23.456.789");
       searchModel.add(row1);
       Map<String, Object> row2 = new HashMap<String, Object>();
       row2.put("id", 2);
       row2.put("tag", "A39900822");
       row2.put("namespace", "nams.foofoo.foo");
       row2.put("ip", "130.42.58.34");
       searchModel.add(row2);
       return searchModel;
       }
      


      Warning from a4j:log - this only happens when I click on populated row
      warn[18:32:56,429]: No information in response about elements to replace


        • 1. Re: datatable, onRowClick and action are not working well to
          bostone

          I just want to stress, that when I click on empty row, everything works fine

          • 2. Re: datatable, onRowClick and action are not working well to
            bostone

            On a second thought - here's complete output from a4j:log (the portion after failed click)

            debug[18:45:10,139]: Have Event [object Object] with properties: target: [object HTMLDivElement], srcElement: undefined, type: click
            debug[18:45:10,139]: NEW AJAX REQUEST !!! with form :modalMasterForm
            debug[18:45:10,139]: Append text control modalMasterForm:j_id52:j_id53:hostname with value [] and value attribute []
            debug[18:45:10,139]: Append hidden control modalMasterForm:j_id52:j_id53:j_id63_hc with value [] and value attribute [null]
            debug[18:45:10,139]: Append hidden control modalMasterForm:j_id52:j_id53:j_id63_state_input with value [] and value attribute [null]
            debug[18:45:10,139]: Append hidden control modalMasterForm:j_id52:j_id53:j_id63_options_input with value [] and value attribute [null]
            debug[18:45:10,139]: Append hidden control _rows_input with value [4] and value attribute [4]
            debug[18:45:10,139]: Append hidden control modalMasterForm:j_id52:j_id53:j_id63:si with value [0,0,10] and value attribute [0,0,10]
            debug[18:45:10,139]: Append hidden control modalMasterForm:j_id52:j_id53:j_id63:s with value [3,3;3;x] and value attribute [3,3;3;x]
            debug[18:45:10,139]: Append text control modalMasterForm:j_id52:j_id53:j_id76:j_id77:j_id87 with value [] and value attribute []
            debug[18:45:10,139]: Append text control modalMasterForm:j_id52:j_id53:j_id76:j_id77:j_id91 with value [] and value attribute []
            debug[18:45:10,139]: Append text control modalMasterForm:j_id52:j_id53:j_id76:j_id77:j_id93 with value [] and value attribute []
            debug[18:45:10,139]: Append text control modalMasterForm:j_id52:j_id53:j_id76:j_id77:j_id102 with value [] and value attribute []
            debug[18:45:10,139]: Append text control modalMasterForm:j_id52:j_id53:j_id76:j_id77:j_id113 with value [] and value attribute []
            debug[18:45:10,139]: Append hidden control modalMasterForm:j_id52:j_id53:searchTogglePanel with value [step2] and value attribute [step2]
            debug[18:45:10,139]: Append hidden control modalMasterForm_SUBMIT with value [1] and value attribute [1]
            debug[18:45:10,139]: Append hidden control javax.faces.ViewState with value
            [DoAlMCfWajRWW0FPCIbHM76DsrJW0ZhbhWBkTpO7xHKv3jcP40gGQZZVFY2mseZmVsVwS2lt884+w2z6lQTF/yuNwcb76I4tYb54QmhzjLM=] and value attribute
            [DoAlMCfWajRWW0FPCIbHM76DsrJW0ZhbhWBkTpO7xHKv3jcP40gGQZZVFY2mseZmVsVwS2lt884+w2z6lQTF/yuNwcb76I4tYb54QmhzjLM=]
            debug[18:45:10,139]: parameter modalMasterForm:j_id52:j_id53:j_id63:3:j_id73 with value modalMasterForm:j_id52:j_id53:j_id63:3:j_id73
            debug[18:45:10,139]: parameter ajaxSingle with value modalMasterForm:j_id52:j_id53:j_id63:3
            debug[18:45:10,139]: Start XmlHttpRequest
            debug[18:45:10,139]: Reqest state : 1
            debug[18:45:10,154]: QueryString: AJAXREQUEST=_viewRoot&modalMasterForm%3Aj_id52%3Aj_id53%3Ahostname=
            &modalMasterForm%3Aj_id52%3Aj_id53%3Aj_id63_hc=&modalMasterForm%3Aj_id52%3Aj_id53%3Aj_id63_state_input=
            &modalMasterForm%3Aj_id52%3Aj_id53%3Aj_id63_options_input=&_rows_input=4
            &modalMasterForm%3Aj_id52%3Aj_id53%3Aj_id63%3Asi=0%2C0%2C10&modalMasterForm%3Aj_id52%3Aj_id53%3Aj_id63%3As=3%2C3%3B3%3Bx
            &modalMasterForm%3Aj_id52%3Aj_id53%3Aj_id76%3Aj_id77%3Aj_id87=&modalMasterForm%3Aj_id52%3Aj_id53%3Aj_id76%3Aj_id77%3Aj_id91=
            &modalMasterForm%3Aj_id52%3Aj_id53%3Aj_id76%3Aj_id77%3Aj_id93=&modalMasterForm%3Aj_id52%3Aj_id53%3Aj_id76%3Aj_id77%3Aj_id102=
            &modalMasterForm%3Aj_id52%3Aj_id53%3Aj_id76%3Aj_id77%3Aj_id113=&modalMasterForm%3Aj_id52%3Aj_id53%3AsearchTogglePanel=step2
            &modalMasterForm_SUBMIT=1
            &javax.faces.ViewState=DoAlMCfWajRWW0FPCIbHM76DsrJW0ZhbhWBkTpO7xHKv3jcP40gGQZZVFY2mseZmVsVwS2lt884%2Bw2z6lQTF%2FyuNwcb76I4tYb54QmhzjLM%3D
            &modalMasterForm%3Aj_id52%3Aj_id53%3Aj_id63%3A3%3Aj_id73=modalMasterForm%3Aj_id52%3Aj_id53%3Aj_id63%3A3%3Aj_id73
            &ajaxSingle=modalMasterForm%3Aj_id52%3Aj_id53%3Aj_id63%3A3&
            debug[18:45:10,154]: Reqest state : 1
            debug[18:45:10,248]: Reqest state : 2
            debug[18:45:10,264]: Reqest state : 3
            debug[18:45:10,264]: Reqest state : 4
            debug[18:45:10,264]: Reqest end with state 4
            debug[18:45:10,264]: Response with content-type: text/xml;charset=UTF-8
            debug[18:45:10,264]: Full response content: <?xml version="1.0"?> <html xmlns="http://www.w3.org/1999/xhtml"><head>
            <link type="text/css" rel="stylesheet"
            href="/namsNG/a4j_3_2_0.SR1-SNAPSHOTorg/richfaces/renderkit/html/css/basic_classes.xcss/DATB/eAF7l.tFHgAHCgJv.faces"
            class="component" />
            <link type="text/css" rel="stylesheet"
            href="/namsNG/a4j_3_2_0.SR1-SNAPSHOTorg/richfaces/renderkit/html/css/extended_classes.xcss/DATB/eAF7l.tFHgAHCgJv.faces"
            class="component" />
            <link type="text/css" rel="stylesheet" href="/namsNG/a4j_3_2_0.SR1-SNAPSHOTcss/tabPanel.xcss/DATB/eAF7l.tFHgAHCgJv.faces"
            class="component" /><link type="text/css" rel="stylesheet"
            href="/namsNG/a4j_3_2_0.SR1-SNAPSHOTcss/panel.xcss/DATB/eAF7l.tFHgAHCgJv.faces" class="component" />
            <link type="text/css" rel="stylesheet"
            href="/namsNG/a4j_3_2_0.SR1-SNAPSHOTorg/richfaces/renderkit/html/css/scrollable-data-table.xcss/DATB/eAF7l.tFHgAHCgJv.faces"
            class="component" /><link type="text/css" rel="stylesheet"
            href="/namsNG/a4j_3_2_0.SR1-SNAPSHOTcss/toggleControl.xcss/DATB/eAF7l.tFHgAHCgJv.faces" class="component" />
            <link type="text/css" rel="stylesheet" href="/namsNG/a4j_3_2_0.SR1-SNAPSHOTcss/table.xcss/DATB/eAF7l.tFHgAHCgJv.faces"
            class="component" /><link type="text/css" rel="stylesheet"
            href="/namsNG/a4j_3_2_0.SR1-SNAPSHOTcss/inplaceinput.xcss/DATB/eAF7l.tFHgAHCgJv.faces" class="component" />
            <link type="text/css" rel="stylesheet"
            href="/namsNG/a4j_3_2_0.SR1-SNAPSHOTorg/richfaces/renderkit/html/css/modalPanel.xcss/DATB/eAF7l.tFHgAHCgJv.faces"
            class="component" /><script type="text/javascript" src="/namsNG/a4j_3_2_0.SR1-SNAPSHOTorg.ajax4jsf.javascript.PrototypeScript.faces">
            </script><script type="text/javascript" src="/namsNG/a4j_3_2_0.SR1-SNAPSHOTorg.ajax4jsf.javascript.AjaxScript.faces">
            </script><script type="text/javascript" src="/namsNG/a4j_3_2_0.SR1-SNAPSHOTorg.ajax4jsf.javascript.ImageCacheScript.faces">
            </script><script type="text/javascript" src="/namsNG/a4j_3_2_0.SR1-SNAPSHOTorg/richfaces/renderkit/html/scripts/browser_info.js.faces">
            </script><script type="text/javascript" src="/namsNG/a4j_3_2_0.SR1-SNAPSHOTorg/ajax4jsf/javascript/scripts/form.js.faces">
            </script><script type="text/javascript" src="/namsNG/a4j_3_2_0.SR1-SNAPSHOTscripts/tabPanel.js.faces">
            </script><script type="text/javascript"
            src="/namsNG/a4j_3_2_0.SR1-SNAPSHOTorg/richfaces/renderkit/html/scripts/scrollable-data-table.js.faces">
            </script><script type="text/javascript" src="/namsNG/a4j_3_2_0.SR1-SNAPSHOTscripts/togglePanel.js.faces">
            </script><script type="text/javascript" src="/namsNG/a4j_3_2_0.SR1-SNAPSHOTorg/richfaces/renderkit/html/scripts/jquery/jquery.js.faces">
            </script><script type="text/javascript"
            src="/namsNG/a4j_3_2_0.SR1-SNAPSHOTorg/richfaces/renderkit/html/script/controlUtils.js.faces"> </script>
            <script type="text/javascript" src="/namsNG/a4j_3_2_0.SR1-SNAPSHOTorg/richfaces/renderkit/html/scripts/data-table.js.faces">
            </script><script type="text/javascript" src="/namsNG/a4j_3_2_0.SR1-SNAPSHOTscripts/comboboxUtils.js.faces"> </script>
            <script type="text/javascript" src="/namsNG/a4j_3_2_0.SR1-SNAPSHOTscripts/inplaceinput.js.faces"> </script>
            <script type="text/javascript" src="/namsNG/a4j_3_2_0.SR1-SNAPSHOTscripts/utils.js.faces"> </script>
            <script type="text/javascript" src="/namsNG/a4j_3_2_0.SR1-SNAPSHOTorg/richfaces/renderkit/html/scripts/utils.js.faces">
            </script><script type="text/javascript" src="/namsNG/a4j_3_2_0.SR1-SNAPSHOTorg/richfaces/renderkit/html/scripts/modalPanel.js.faces">
            </script><script type="text/javascript" src="/namsNG/a4j_3_2_0.SR1-SNAPSHOTorg/richfaces/renderkit/html/scripts/modalPanelBorders.js.faces">
            </script><script type="text/javascript" src="/namsNG/a4j_3_2_0.SR1-SNAPSHOTprototype.js.faces">
            </script><meta name="Ajax-Update-Ids" content="" /><title></title></head><body><span id="ajax-view-state">
            <input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState"
            value="DoAlMCfWajRWW0FPCIbHM76DsrJW0ZhbhWBkTpO7xHKv3jcP40gGQa1K7tgDosJ2VsVwS2lt884+w2z6lQTF/yuNwcb76I4tYb54QmhzjLM=" />
            </span><meta id="Ajax-Response" name="Ajax-Response" content="true" /></body></html>
            debug[18:45:10,279]: Header Ajax-Expired not found, search in <meta>
            debug[18:45:10,279]: search for elements by name 'meta' in element #document
            debug[18:45:10,295]: getElementsByTagName found 2
            debug[18:45:10,295]: Find <meta name='Ajax-Update-Ids' content=''>
            debug[18:45:10,295]: Find <meta name='Ajax-Response' content='true'>
            debug[18:45:10,295]: Header Ajax-Update-Ids not found, search in <meta>
            debug[18:45:10,295]: search for elements by name 'meta' in element #document
            debug[18:45:10,311]: getElementsByTagName found 2
            debug[18:45:10,311]: Find <meta name='Ajax-Update-Ids' content=''>
            warn[18:45:10,311]: No information in response about elements to replace
            debug[18:45:10,311]: call getElementById for id= org.ajax4jsf.oncomplete
            debug[18:45:10,311]: call getElementById for id= ajax-view-state
            debug[18:45:10,311]: Hidden JSF state fields: [object HTMLSpanElement]
            debug[18:45:10,311]: Namespace for hidden view-state input fields is undefined
            debug[18:45:10,311]: search for elements by name 'input' in element span
            debug[18:45:10,326]: getElementsByTagName found 1
            debug[18:45:10,326]: Replace value for inputs: 31 by new values: 1
            debug[18:45:10,326]: Input in response: javax.faces.ViewState
            debug[18:45:10,326]: Found same input on page with type: hidden
            debug[18:45:10,326]: Found same input on page with type: hidden
            debug[18:45:10,326]: Found same input on page with type: hidden
            debug[18:45:10,326]: search for elements by name 'INPUT' in element span
            debug[18:45:10,342]: getElementsByTagName found 0
            debug[18:45:10,342]: Replace value for inputs: 31 by new values: 0
            debug[18:45:10,342]: call getElementById for id= _ajax:data
            debug[18:45:10,342]: call getElementById for id= _ajax:data
            debug[18:45:10,342]: call getElementById for id= _A4J.AJAX.focus
            debug[18:45:10,342]: No focus information in response
            
            
            


            • 3. Re: datatable, onRowClick and action are not working well to
              ilya_shaikovsky

              if the request is fired but actionListener is called - the first thing to do is checking server side log for messages or put rich:messages on the page.