Editable tables & server side processing
Editable tables & server side processing
col.brazier
Posts: 26Questions: 2Answers: 0
Hi,
I would like to combine:
* editable tables
* server side processing
* add/delete rows
My example is at www.fobgfc.org/sq2.php
Any help would be appreciated.
Thanks, Colin
I would like to combine:
* editable tables
* server side processing
* add/delete rows
My example is at www.fobgfc.org/sq2.php
Any help would be appreciated.
Thanks, Colin
This discussion has been closed.
Replies
So the first issue I see with what you've currently got is that jEditable doesn't do live events unfortunately (there are a few discussions around if you Google for them, on how to make it do live events - but that is probably an optimisation that you can make at a later date :-) ). What you need to do is have the jEditable initialisation inside the fnDrawCallback (which you currently have commented out). That will add the jEditable plugin to the table.
To add and delete rows, you'll probably want a button or something to trigger the event. What I tend to do when creating this kind of table is to use TableTools to have Add / Delete buttons and also deal with row selection (although I think in this case it might be better just to have a delete button on each row). From there you can add an event handler to the add and delete buttons which will fire of the XHR needed for each option.
Allan
http://www.fobgfc.org/sqedit_07.php
I need to add a "Save changes" button, but my main question is now, should I validate/update the whole list at once or just page by page? I know this might be getting away from being a purely Datatables question now but how/where can I attach an update event to the page numbering, if I should take the "one page at a time" route?
Thanks again for your understanding!
Colin
With the approach you've taken of having all the editable fields in a permanently "editable" mode I'd suggest one of two different ways:
1. Save on every edit - i.e. each click on the checkboxes is saved by sending an XHR to the server and the inputs could have a keypress for similar (you could use a setTimeout a bit like the fnSetFilteringDelay plug-in for DataTables to save DDOSing your own server :-) ).
2. Have a 'Save' button which will apply all changes made (regardless of the page). I wouldn't have thought (as a user) that changing page or sorting etc would fire off a save (although if you did want to do it that way you could use fnDrawCallback).
Hope this helps a bit!
Regards,
Allan
Ta again. Is the approach I've taken outdated? (you can be candid!).
Colin
Allan