Home » Jquery » javascript – Update data only on UI without storing in database || Django

javascript – Update data only on UI without storing in database || Django

Posted by: admin February 22, 2020 Leave a comment

Questions:

In my Django project, in one of the views, I currently have a table with some data in the web page with Excel download functionality of entire table data.

Now, I wanted to add edit option at every cell, where user can edit and update it and the changes should only reflect in the UI and the downloaded excel should contain the data of the updated values and these updated values are not stored on any database.

Please suggest how to proceed on this.

How to&Answer:

First of all you have to manage unique html id for that particular row in table.After you have to use Ajax for changing UI only.

When click on edit button of table row you have to pass id of that table row to edit form page. After edit form successfully it’s time to call Ajax.

Then user will be pressed update button, at that time you have to call Ajax. Now, pass that row’s id in Ajax data which will get in Django view.

From Django view return success response. So, it will redirect on success part of Ajax. In this success part of Ajax, you have all required information like id of row which you want to change in UI, edited data of that row etc.

So, with the use of Ajax you can change only UI as per your requirements.