However, what I need is a bit more complex. I want to show the tables orders and orderdetails in the same page to add new orders and several new orderdetails to each order.
Adding a new order: When I create a new order, I would like to add several items at the orderdetails table (products, quantities and prices) in the same page. At this example, ordernumber would be a hidden foreign key at orderdetails table and this field should be automatically populated by the active ordernumber in orders table.
Viewing orders: When naviganting between orders, the selection of one order should instantly refresh the query in orderdetails table in the same page to show only the records related to that especific order. And then, I should be able to edit the orderdetails.
If I have a one to many relation of complex tables, can I view and edit the tables on the same page?
Let's use a classic case to explain what I need (attachment below):
if I want to choose products inside order details, I would use a dropdown as ilustrated at https://wpdatatables.com/documentation/front-end-editing/configuring-table-relations-foreign-key/
However, what I need is a bit more complex. I want to show the tables orders and orderdetails in the same page to add new orders and several new orderdetails to each order.
Adding a new order: When I create a new order, I would like to add several items at the orderdetails table (products, quantities and prices) in the same page. At this example, ordernumber would be a hidden foreign key at orderdetails table and this field should be automatically populated by the active ordernumber in orders table.
Viewing orders: When naviganting between orders, the selection of one order should instantly refresh the query in orderdetails table in the same page to show only the records related to that especific order. And then, I should be able to edit the orderdetails.
Could you teach me how to do this?
Hi Luis,
Thank you for your purchase.
You have to make SQL query that return data that you need. After that you should use "Creating Tables in WordPress based on MySQL queries" and that table will be editable.
Kind Regards,
Isidora Markovic
wpDataTables: FAQ | Facebook | Twitter | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Amelia demo sites | Docs
You can try our wpDataTables add-ons before purchase on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables