Datatable cache problem
Datatable cache problem
Lokeshwari
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.
This discussion has been closed.
Replies
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()
orrows().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
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
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
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?
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
I have attached my file. Thanks in advance
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.
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 userow( 'my selector' ).invalidate().draw();
. Otherwise use the pluralrows
without a selector to invalidate all rows. The singular would be more efficient.Kevin
Thanks. it worked.thanks a lot for ypur patience