How to align form fields within a table for inline editing?

faizool

New Member
I am developing a webapp using Spring, jsp, javascript, jquery.I display a table using datatables.When I click on a table row I want it to change all fields to an inline edit inputs, selects etc. In addition I want to show some extra input fields in the next row and a save button.Now I see several ways of doing this. I am not sure which one to take.[*]I can get a handle to selected row and then iterate over the td and transform them to input/select fields. I can then insert an extra row for the new fields and the save button.I don't see this as a clean solution. I will have to issue a Post manually instead of using the Spring ModelAttribute binding for the form. (Can I still use ModelAttribute here?)[*]I can create an edit form in a jsp file which looks like: Note I do not have a beginning in a jsp file as I plan to reuse the tr from the existing row in the table.This way I would be able to have a clean form and also use the update method I have already written which binds the form to a Java class. Also I do not have to bother about the alignment of input fields with the column names.The generated html looks like ... The problem with this approach is the placement of form element in the html causes the entire form to be cramped into one cell of the table which does not look good and messes up the whole layout. Is there a way out? Should I just replace the contents of the table with a having a colspan and then put divs inside this element and fine tune the css to ensure that the input fields align with the column names in the table?
u0hdy.png
Is there a better solution you can suggest?
 
Back
Top