fnOpen on empty table?
fnOpen on empty table?
I have been using fnOpen to allow users to update or delete rows from a table with server side processing. That has been great.
Now I would like to use the same approach to adding new data. I'd like to basically open a row, allow the user to insert the data, press "Save", and then redraw the table. This works fine when I can call fnOpen on an existing row, but I am unable to make this work when the table is initially empty.
I tried calling fnOpen using the tr element within the thead, but it appears that DataTables only allows fnOpen to work on tr elements within the tbody. I've tried first calling fnAddData, but that just doesn't seem to work when server processing is enabled. I found this discussion, http://datatables.net/forums/comments.php?DiscussionID=2674, which mentions that the second parameter to fnAddData needs to be false, but I am still unable to have a row added using that.
So in summary, is it possible to get fnOpen() to work when I do not already have a row in the table? A workaround might be to have the server return a fake row whenever there isn't any real data, but I'd prefer to get this to work cleanly if possible.
Now I would like to use the same approach to adding new data. I'd like to basically open a row, allow the user to insert the data, press "Save", and then redraw the table. This works fine when I can call fnOpen on an existing row, but I am unable to make this work when the table is initially empty.
I tried calling fnOpen using the tr element within the thead, but it appears that DataTables only allows fnOpen to work on tr elements within the tbody. I've tried first calling fnAddData, but that just doesn't seem to work when server processing is enabled. I found this discussion, http://datatables.net/forums/comments.php?DiscussionID=2674, which mentions that the second parameter to fnAddData needs to be false, but I am still unable to have a row added using that.
So in summary, is it possible to get fnOpen() to work when I do not already have a row in the table? A workaround might be to have the server return a fake row whenever there isn't any real data, but I'd prefer to get this to work cleanly if possible.
This discussion has been closed.
Replies
Allan