Inline Editing vs. Dialog Editing
Inline Editing vs. Dialog Editing
Please use the following link for the test case:
http://58.64.211.82/Ed/examples/advanced/linkTable2.html
which should be rather self-explanatory after one or two minutes of fooling around with it.
The full source code and mysql script are available from the following link:
http://58.64.211.82/Ed/examples/sources/linkTable2.zip
The datatable in this test case involves two tables joined together via a Left Join, as follows:
SELECT ... FROM products LEFT JOIN product_details ON products.item_code = product_details.item_code
The issue is:
Inline Editing does not seem to work for any of the columns from product_details
, whereas it does work well for the columns from products
.
However, when I use the Light-box Editing Dialog (invoked by clicking the "Edit" tool button) to edit the data, all the columns in the datatable can be edited and updated correctly.
The question is: why is the Inline Editing behaving inconsistently with the Light-box Editing Dialog? More importantly, what do I have to do to make the Inline Editing work just as well as the Dialog Editing?
The second issue is with the deleting. When I deleted a row from the datatable, only the row from products
was deleted, but the row from product_details
was still there even after the Delete action.
Thus, how could I ensure that the Delete action would actually delete the relevant rows from both tables?
Replies
By default Editor's inline editing will only submit the value that has changed. When you are editing a joined table, that isn't enough information for the server to be able to correctly update the database. It needs to submit the full data row, which you can do using the
submit
option of theform-options
property that can optionally be passed intoinline()
.i.e. change
editor.inline( this );
to be:There is no option with the PHP (or .NET) libraries to delete from the left joined table at this time. You would need to use a
postRemove
server-side event to remove them.The reason for this is that generally (although not always obviously) it can still be useful to reference the joined information if creating a new row (for example, if you have a car which is left joined to the colour "blue" you wouldn't delete "blue" because the car was deleted).
Allan
Much obliged, Allan.
It's now working beautifully well, after doing as you instructed.