Add a new record in the first row of the table

Add a new record in the first row of the table

m.yazdian20@yahoo.comm.yazdian20@yahoo.com Posts: 2Questions: 1Answers: 0

I'll get my data through AJAX from the server and display it without any problems.
Now, when I save the new record in the database, I want to update the table without using AJAX.
In fact, I want to add a new record in the first row of the table
please guide me

Answers

  • kthorngrenkthorngren Posts: 21,300Questions: 26Answers: 4,945

    The Sorting with absolute positioned data blog may help:

    Kevin

  • m.yazdian20@yahoo.comm.yazdian20@yahoo.com Posts: 2Questions: 1Answers: 0

    Thank you for the answer you gave, but I think that I asked my question badly and you did not know exactly what exactly was your problem.
    Let me explain to you with a practical example.
    Please look at the example below:
    Add Rows

    In this example, when the user clicks on the Add New Row button, the rows are added to the table as follows:
    Column 1
    1.1
    2.1
    3.1
    4.1
    5.1
    ...

    Now, my question is, what changes should be made to the code in the example, until the user clicks the button to add the new row, the table rows are added to the table as follows?
    Column 1
    ...
    5.1
    4.1
    3.1
    2.1
    1.1

  • kthorngrenkthorngren Posts: 21,300Questions: 26Answers: 4,945

    In that example the table is ordered by column 0 ascending by default. You can change the ordering of column 0 to descending using the order to descending. This only affects the initial order of the table and, if allowed by the ordering option, can be changed by the user. You can use the order api to set the order how you desire each time you add rows.

    If this is not answering your question or what you want maybe you can put together a simple example of your table with a row add button. Then we can help you with options to achieve your goals.

    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

This discussion has been closed.