Datatable cache problem

Datatable cache problem

LokeshwariLokeshwari Posts: 16Questions: 3Answers: 0

i am facing one issue with jquery datatable
that is ,

i am displaying the data which is submitted by one form,
form is in popup
when i submitting pop is getting close
so immediately that data is not getting displayed in data table.
i am using LIST to get data from database
and iterating list to display in datatable.

can any one help me to sort out this problem.

Thanks in advance.

Replies

  • kthorngrenkthorngren Posts: 21,303Questions: 26Answers: 4,947

    Sounds like you might be updating the table directly and not using Datatables API's for the update. If doing this then Datatalbes does not know about the changes and you will need to use one of the invalidate methods like row().invalidate() or rows().invalidate().

    If this doesn't hep then please provide more specifics of hwo you are making the updates. A link to your page or a test case would be helpful.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • LokeshwariLokeshwari Posts: 16Questions: 3Answers: 0

    seems like iit would help me but i'm new to datatables. could you please explain me in detail about rows.invalidate() . how to use it

  • kthorngrenkthorngren Posts: 21,303Questions: 26Answers: 4,947
    edited November 2018

    Here are the docs:
    https://datatables.net/reference/api/rows().invalidate()

    Let us know if you have questions. BTW, in case you didn't notice these are links to the docs: rows().invalidate().

    Kevin

  • LokeshwariLokeshwari Posts: 16Questions: 3Answers: 0

    sorry for that. But i want to load new data from database. i'm even trying to call service which in turn return dataset. but that service is not hitting. May be cache issue.How to overcome this?

  • kthorngrenkthorngren Posts: 21,303Questions: 26Answers: 4,947

    How are you calling the service?

    Without seeing your code its hard to say. Maybe you need to check the error log at the service.

    Kevin

  • LokeshwariLokeshwari Posts: 16Questions: 3Answers: 0

    I have attached my file. Thanks in advance

  • LokeshwariLokeshwari Posts: 16Questions: 3Answers: 0

    Data is loading for the first time. if i perform any operations like add/Edit/Activate data is saving properly in Database but it is not displaying immidiately. if i refresh page after some time, the changes are reflecting.

  • kthorngrenkthorngren Posts: 21,303Questions: 26Answers: 4,947

    There is a lot going on in that code to just walk through without explanation. I didn't look in detail to find where you are updating the table. Maybe you can just post that snippet of code. It seems like you are updating the html table directly, is this correct?

    If that is the case then right after you update the table you will use one of the invalidate methods. If you have a /row-selector for just the row being updated then you can use row( 'my selector' ).invalidate().draw();. Otherwise use the plural rows without a selector to invalidate all rows. The singular would be more efficient.

    Kevin

  • LokeshwariLokeshwari Posts: 16Questions: 3Answers: 0

    Thanks. it worked.thanks a lot for ypur patience

This discussion has been closed.