adding a new row to server side datatable without ajax call
adding a new row to server side datatable without ajax call

Hi, here is my problem :
I have a datatable and I want to add a new row, data of this row comes from a websocket and I would like to add this like as the first line of my datatable to say like "this line is new" dynamically. The problem is, when I write mydatatable.row.add([...]); I need to do a .draw() to update the display, but then it's doing an ajax call and remove the edit I've done.
I've read some post saying that row.add is not really what I should do with server side enabled, but ... is there a way to do this ?
Any way to do a .draw() but skip the ajax call and return an edited version of the actual data ? (maybe override the .draw() function with a parameter value, for example, .draw('noajax'), something like that ? So it would redraw the table based on the actual data )
Many thanks
Replies
Hi @fdalex ,
As you say, you need the data there after the draw, so one option would be to use a function for
ajax.dataSrc
(see the last example on that page) and add that row into the returned data.Cheers,
Colin
Thanks you, I will try this
hi ! I managed to do what I wanted with ajax.dataSrc, thank you @colin !