4 Replies Latest reply on Nov 14, 2008 9:42 AM by Ilya Shaikovsky

    Delete row in a rich:dataTable

    Nicolas U. Newbie

      Hello (again) i have (again) a probleme.

      I want to make a datatable with a delete option for each row (Ajax of course)

      look like this:

      [img]http://pix.nofrag.com/2/d/a/47c8f897c48f6a2e2f858ddee33b7.png[/img] (why [img] balise don't work?)

      I have something who delete but only 1 time. If i want delete another row it's crash...


      <rich:dataTable id="packageList" value="#{pc_Index.listpackage}" var="file">
       <f:facet name="header">
       <h:outputText value="File number" />
       <h:outputText value="Delete" />
       <h:outputText value="#{file}" />
       <a4j:commandLink id="delete" action="#{pc_Index.deletePackNumList}" reRender="packageList">
       <h:graphicImage style="border: none;" url="/img/delete_over.gif" />

      And in BackingBean:
      protected List<String> listpackage = null;
      public void deletePackNumList() {
       System.out.println("delete one row");
       String delme = (String) getPackageList().getRowData();
       System.out.println("row to delete: " + delme);
       System.out.println("new listpackage: " + listpackage);

      It's work first time then crash. look my log:

      delete one row
      row to delete: 789
      new listpackage: [123, 456, 321, 654]
      delete one row
      java.lang.IllegalArgumentException javax.faces.el.EvaluationException: java.lang.IllegalArgumentException
      at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:108)
      at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
      at javax.faces.component.UICommand.broadcast(UICommand.java:387)

      The getRowData() don't work a second time. I use it bad, or it's not the good method.

      if you know a sample with delete row it fine too.