Add rows based on cell values

Add rows based on cell values

mihalispmihalisp Posts: 127Questions: 22Answers: 0

Hi everybody,
I am trying to add multiple rows at once when i click a button,based on specific rendered-computed cell values.
The columns that will have new values in the added rows will be only 2,the 'Year' and the 'max_days'.
The new 'year' will be the current Year for all added rows while the 'max_days' will be the value of the computed column 'days_left'.All the other columns will be fixed.

Do i need Editor for this?

Thank you

Replies

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    Editor is an optional extension, but it does speed up development if you're updating to a database. If you're just adding the rows in the local table, and you don't want the data updated in a remote database, then you wouldn't need Editor.

    Colin

  • mihalispmihalisp Posts: 127Questions: 22Answers: 0

    Yes,the data in this datatable comes from only 1 table in Sql Server.
    I thought that only with Editor i can update-insert in db.

    How can i achieve this?

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    You can use create() to create rows through the API - something like this example here.

    Colin

  • mihalispmihalisp Posts: 127Questions: 22Answers: 0

    What is the difference if i use the rows.add() ?

  • kthorngrenkthorngren Posts: 20,276Questions: 26Answers: 4,765
    edited December 2019

    rows.add() is specific to Datatables (no Editor functionality) and only adds rows to the HTML table in the client. To update a database you will need to use an Ajax request to the server with the rows to add.

    Kevin

  • mihalispmihalisp Posts: 127Questions: 22Answers: 0

    thank you

This discussion has been closed.