submit full row data with select lists
submit full row data with select lists
Hello,
I have a table / editor with 5 columns set as type: select and the editor is set to use inline editing.
I wish to allow a user to make changes to one or more values (cells) in the row and then submit all changes at once.
The trouble I'm having is that the editor is only tracking 1 field change at a time. If I make a change to the value in column one (via the select list) and then move and change the value in column two... then save, only the last value changed is passed back.
The other changes are not being submitted with the save event.
What should I do to correct this behavior?
Please let me know and thanks,
~ Dave
This question has accepted answers - jump to:
Answers
I'm afraid that a buffered submit is not something that Editor supports at this time. It needs to submit the data on each edit. You could potentially provide a custom
ajax
function that would create that buffer, but it isn't something that is built in (yet - I hope to add in in a future version, although that might be a little way off).Allan
Hello Allan,
Thanks for the quick reply.
Is it possible to edit the existing rows cell data? If so, perhaps I can simply place the selected value (Id) in the appropriate table cell.
When I submit, I can get the changed values from the data.data[key] like this;
VendorOptionId: data.data[key].VendorOptionId
Would this be possible?
Please let me know and thanks,
~ Dave
As in use DataTables as the data store? That isn't something that is built in to Editor at the moment, but will be available in 1.6 (this summer). Until then, you would need to use
ajax
to provide a custom function for this. If you were to use thesubmit
option of theform-options
object to submit the full row, you could just send that back - something like:It's a little cheeky, but that should work (i.e. it just passed back the submitted data as the "new" data). It may need a tweak, but I think that should work.
You can then use
rows().data()
to get the data from the whole form and submit to the server for saving (although the provided PHP and .NET libraries wouldn't work for that, you'd need some custom code).Allan
Hello Allan,
In the previous comment you indicate that the new feature "will be available in 1.6 (this summer)."
Would you happen to know when 1.6 is scheduled to be deployed? I'd like to plan some changes around this update but need a date if possible.
Please let me know and thanks,
~ Dave
I don't have a firm date I'm sorry to say, which is why I was a bit vague above - I'm still working out the best path for the various pieces of work I have planned for the immediate future. Best I can really say is to keep an eye on the release feed or Twitter if you don't use RSS.
Allan
Hello Allan,
Thanks for all your help.
I was able to take your suggestions and implement a solution that works very nicely.
I can now edit all the data 'inline' (including multiple rows) and then submit all changes with a single submit.
I even perform some data validation while cells are being edited and change the background to red if data is missing.
I can share any snippets if you or anyone else would like to see.
In any case, thank you again for helping out!
Case closed. :-)
~ Dave
Hi, I am trying to do Inline editing could you please send the code thankyou
There are examples of how to do inline editing in the Editor examples.
Allan