4 Replies Latest reply on Jun 11, 2007 1:41 AM by yannlaviolette

    Link to edit item of datatable

    yannlaviolette

      Hi!

      I have a datatable connected to a List (that come from a DB). I want to put a link in the table to edit a row.

      For example

      ID | NAME | EDIT ICON
      ---------------------------
      1 | TOTO | Icon
      1 | TATA | Icon
      1 | TITI | Icon

      I want to click on the icon and this icon open me another JSP page where I can edit the data. In PHP I was using an HTTP post var and I the php file told me to edit an item with an ID. I've googled but I don't find anything interesting.

      Can somebody help me, I'm stalled!!!

      Thanks a lot! Your help is very appreciated!

      Yann Laviolette

        • 1. Re: Link to edit item of datatable
          vh

          I think you can do this:
          put that icon into a link, when click on the link, you pick up the id of that row ( I save the id in a column that is not displayed and I find that Id with javascript) and put it into a form hidden field (which is mapped to your bean), then you launch your modalPanel, the id should be in your bean now.

          Or if you actually go to a new URL, you can just add parameters to the URL, the parameter be the row id.

          • 2. Re: Link to edit item of datatable
            yannlaviolette


            I was planning to use this option

            "vh" wrote:

            Or if you actually go to a new URL, you can just add parameters to the URL, the parameter be the row id.


            But I don't know how to extract parameter from the url. I've search on the Internet but I don't find anything. Maybe I didn't look at a good site. Do you know how to extract parameter from the URL?

            Thanks a lot!

            Yann

            • 3. Re: Link to edit item of datatable
              vh

              FacesContext.getEnternalContect().getRequestParameterMap().

              • 4. Re: Link to edit item of datatable
                yannlaviolette

                 

                "vh" wrote:
                FacesContext.getEnternalContect().getRequestParameterMap().


                Thanks a lot! It works!

                Yann