0 Replies Latest reply on May 15, 2013 2:00 AM by cheeray

    ExtendedDataTable - MultipleKeyboardFree mode - Get the clicked row in "selectionchange" listener

    cheeray

      Hi All,

      I need to get the clicked row in selection change listener. I added a4j:ajax to fire the selection change event, but can't make another a4j:param working to set the clicked row. Nor another a4j:ajax to listen on the row clicked event.

       

      The only way I found to get the row index in the selection change listener is to hack:

       

      private static class TableSelectionHelper
                {
                          public static long getClickedRow(String clientId)
                          {
                                    final Map<String, String> params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
                                    final String si = params.get(clientId + ":si");
                                    final String[] parts = si.split("\\|");
                                    switch (parts.length)
                                    {
                                    case 1:
                                              return Long.parseLong(parts[0]);
                                    case 2:
                                              return Long.parseLong(parts[1]);
                                    }
                                    return -1l;
                          }
                }
      
      

       

      Any good ideas to avoid this? Thanks.