Editable rows and tables

Editable rows and tables

rehproprehprop Posts: 2Questions: 0Answers: 0
edited May 2011 in General
Hello All, we have editables working well but we would like to expand functionality to open up the entire row (or at least all editable columns) to be edited, much like editable rows in jqGrid. The callback should send the entire row's contents back to the server.

We would also like to open up the entire table, so that all rows become editable, with a single callback that sends all datatable contents back to the server.

Has anyone tried this?

Replies

  • ricaluannaricaluanna Posts: 1Questions: 0Answers: 0
    edited May 2011
    I also would want to know the answer to this.
  • allanallan Posts: 63,113Questions: 1Answers: 10,395 Site admin
    Hi folks,

    I presume that you've used the jEditable plug-in for jQuery in order to get editable cells thus far? The jEditable plug-in is fine, but it is limited (intentionally so by the author) to consider just one element at a time as being editable. So it isn't particularly well suited towards providing the ability to make the whole row editable. Having a look around on Google flashes up this page http://www.makina-corpus.org/blog/howto-create-complex-editable-fields-jeditable-and-make-it-sending-all-form-content which describes how it might be possible to make jEditable to do what is needed - but frankly my eyes when crossed when reading it :-)

    I rather suspect that it will be easier to just write a small function which would provide the editing abilities that you require. I can't do this right at the moment I'm afraid (flying out the door to work), but I will give it a go when I get back this evening and post back here with how I get on.

    Regards,
    Allan
  • allanallan Posts: 63,113Questions: 1Answers: 10,395 Site admin
    Here is one method of doing it: http://datatables.net/dev/row_edit.html . It's quite a simple example - but that is an advantage in this case I think so that it been be easily modified and adapted. You'll need to right click and 'view source' to see the code behind it - there is only 60 lines of Javascript needed to get that interaction. There isn't an Ajax save at the moment, which you might well want, but that could be put into the saveRow() function.

    I think this is probably a worthy topic for a blog post in the near future... :-)

    Hope this helps!

    Regards,
    Allan
  • rehproprehprop Posts: 2Questions: 0Answers: 0
    edited May 2011
    Allan, thanks for this.
  • kmorikmori Posts: 1Questions: 0Answers: 0
    Allan,
    this solution works fine until I rerender the table. It gives the error: "s is null" at line "for ( i=s._iDisplayStart, iLen=s._iDisplayEnd ; i
This discussion has been closed.