Edit cells with a modal / Display all data on a row

Edit cells with a modal / Display all data on a row

Jeff23Jeff23 Posts: 8Questions: 3Answers: 0

Hello Members,

I have two issues that I would know if it is possible so do:

  1. When I press a row I would like to get a modal open with input fields so I can update two specific columns. Is it possible? I know there names but not where in the table they are placed (which column)
    See link: http://live.datatables.net/upgrade/2071/edit

  2. When I press a row I would like to get up a modal that display all items on the row, dynamic. I do not know how many columns and there names.

/Jeff

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,173Questions: 26Answers: 4,923

    You can use table.row(this).data(), like you have commented out, to get the row data. You can use columns().header() to get the th for each column. Use a loop to access each data element and th element to build the fields for your form. When the form is submitted you can use row().data() to update the row in the client. You will need to use a jquery ajax() request to perform server updates.

    Another option is to use the Editor to handle the form and editing processes.

    Kevin

  • Jeff23Jeff23 Posts: 8Questions: 3Answers: 0

    Hello Kevin,

    Thanks for taking the time! Can I get the number of columns in the table? The table is dynamic.

    Jeff

  • Jeff23Jeff23 Posts: 8Questions: 3Answers: 0

    I would like to loop over every column even the hidden columns and display the values.

  • kthorngrenkthorngren Posts: 21,173Questions: 26Answers: 4,923
    Answer ✓

    Can I get the number of columns in the table?

    Use columns() with count() like this:

    table.columns().count()
    

    loop over every column even the hidden columns and display the values.

    Use columns().every() for this.

    Kevin

  • Jeff23Jeff23 Posts: 8Questions: 3Answers: 0

    Great support Kevin!!

This discussion has been closed.