3 Replies Latest reply on Apr 5, 2010 5:24 PM by Carlos juarez

    Richfaces extendedDataTable row select issue

    pradeep meruva Newbie

      Hi All,


      I am using rich:extendedDataTable for list the companies from the database. Now I want to select and scroll through the rows in the extendedDataTable and click enter, that the currently active row data is presented in a separate modelpanel.


      I am using the hotkey support for the enter key event. but i am not able to send the id of the row/company selected, when i am using the key board arrows.
      please help me how I go about dealing with this issue.


      But rowClick and RowDBclick events are working fine. but I need to find solution if the user scrolls through the dataTable using keyboard arrowkeys.


      Thanks in advance,
      Pradeeep.

        • 1. Re: Richfaces extendedDataTable row select issue
          Todd Gould Newbie

          I have never done this; however, I would think you could track the selection with something like


          <a4j:support event="onkeyup" ....



          or


          <a4j:support event="onkeypress" ...



          and using the associated action method to select the appropriate row of the table. You will need to use binding or another method  (search the component tree) to access the underlying dataModel and perform the selection in the refernced action method.  Assuming the row is actually selected in the dataModel, this should support the sending of the proper row data when the Enter key is subsequently pressed.


          • 2. Re: Richfaces extendedDataTable row select issue
            pradeep meruva Newbie

            Hi Todd,


            thanks for the reply.


            I have tried using the



            <a4j:support event=onkeyup .....


            I am not able to pass the object or row selected to the action method.


            can u please detail me how I go about using dataModel fro the richfaces extended data table.


            thanks ,
            pradeep

            • 3. Re: Richfaces extendedDataTable row select issue
              Carlos juarez Newbie
              I hope you problem is solved. But anyway, with jQuery is very easy, may is not the best solution but work for me:


              <script type="text/javascript">
                   
                         function esc(myid) {
                             return '#' + myid.replace(/(:|\.)/g,'\\$1');
                        }
                   
                        function showPanel(event){
                          if (event.keyCode == 13){
                                  var els =jQuery(esc('#{rich:clientId('itemsFound')}') + ' .extdt\\-row\\-selected');
                                  if(els.length>0){
                                       els[0].ondblclick(event);return false;
                                  }                      
                          }
                      }
                   
                    </script>
                   
                   
                   
                   
                    <rich:extendedDataTable id="itemsFound" onkeypress="showPanel(event)"
                                                          selectionMode="single" enableContextMenu="false">
                        .
                        .
                        .
                   </rich:extendedDataTable>