deleting JSon loaded data? (even just on the client)
deleting JSon loaded data? (even just on the client)
javahollic
Posts: 11Questions: 0Answers: 0
Hi,
I have a table loading dynamic Json data, great. Following the delete example, I can't figure out how to get the data in the browser to be deleted. The example seems to work fine for 'static' HTML, but there isn't one for dynamically loaded Json data. Is there something Im missing with that approach?
Here is the script bit:
[code]
function fnDeleteSelected( oTableLocal )
{
var aTrs = oTableLocal.fnGetNodes();
for ( var i=0 ; i
I have a table loading dynamic Json data, great. Following the delete example, I can't figure out how to get the data in the browser to be deleted. The example seems to work fine for 'static' HTML, but there isn't one for dynamically loaded Json data. Is there something Im missing with that approach?
Here is the script bit:
[code]
function fnDeleteSelected( oTableLocal )
{
var aTrs = oTableLocal.fnGetNodes();
for ( var i=0 ; i
This discussion has been closed.
Replies
and also from an int value: oTable.fnDeleteRow(0); etc, but both seems to result in the same non deletion...
If you want to delete rows, and use server-side processing, you need to actually do the delete on the database - where all the information is kept.
Regards,
Allan
OK I get you, so in the delete.click, I do ajax to the server to trigger deletion of the index selected (um I hope that keeps working with paging?) then call fnDeleteRow to get the byproduct of a full refresh?
thanks,
andy
What you need to do is:
1. Send an XHR to delete the row from the database
2. Call fnDraw() on the table to 'refresh' the display (with the deleted row now gone!)
There is no need to call fnDeleteRow at all when using server-side processing, it doesn't provide any use. The pagination is automatically taken care of since DataTables will just redraw the data without the row from the server now.
Regards,
Allan