How to have a button at the end of a row that takes the ID and opens a new page

How to have a button at the end of a row that takes the ID and opens a new page

GlyndwrGlyndwr Posts: 117Questions: 32Answers: 0

I am using HTML, Ajax, javascript, JSON and java.

I have a table of data and would like a way to open a new page using the row ID (hidden column) as the key to get the data to populate the new page. At the moment I am doing this by creating the html in java and passing this back to the Ajax/javascript and HTML.

This is an example. Selecting the "Update" button will open a page with all the details of the event (a large amount of data) so changes can be made. Selecting the "Copy" button will create a clone of the activity so the details can be changed and saved as a new activity (very similar to the update). Selecting the "View Participants" button will display a list of everyone who has signed up to the activity. I am using buttons; however, I am open to ideas of better ways to do it in DataTables. For instance I am thinking of purchasing the extension that does the update when a row is selected. However, I think that will be just to update the four fields shown in the table.

Kind regards,

Glyn

This question has an accepted answers - jump to answer

Answers

  • rf1234rf1234 Posts: 2,801Questions: 85Answers: 406
    Answer ✓

    Hi Glyn,

    you could simply use Editor not to open a new page but a popup to Edit all of the details. That is really easy to do as you can see in the Editor examples. There can be a lot more data in the Editor popup than you have in the data table. No problem. You can even have multiple Editor instances for the same table.

    To get the ids of the rows you can use this: https://editor.datatables.net/reference/api/ids()

    This is an example of Editor in table buttons:
    https://editor.datatables.net/examples/simple/inTableControls.html

  • GlyndwrGlyndwr Posts: 117Questions: 32Answers: 0

    Oh brilliant! I knew the brains trust would give me a better way. Thank you.

    Kind regards,

    Glyn

This discussion has been closed.