Datatables Editor - Nested
Datatables Editor - Nested
I've been editing the Nested editing table in order to understand if it can do what I need, but i'm having no luck finding out.
I have a table with a list of customers.
table Customers:
fields: id, CustomerName
row: 455, 'JOHN DOE'
I would like to add to this customer some invoice numbers and date
table Invoices:
fields: id, date, CustomerID
row: 1, 2023-06-26, 455
row: 2, 2023-06-26, 455
If there's no invoices of a customer, the nested will be empty but available to add new lines
Using this logic, is it possible to use the Nested editing?
This question has an accepted answers - jump to answer
Answers
You probably want the parent / child editing example instead. With that you can have a different set of data in the child table for each parent row (which I think it what you are looking for).
Allan
that's exactly right, thank you allan
While still on this topic, I'm having a little problem and I can't figure how to solve.
Regarding the parent / child editing example I noticed when I'm creating a new Site I can't associate users right away - The entry has to be submitted into the database and then after that I'll go the newly create Site and associate Users.
I need a workaround for this so my idea was after saving the new Site, close and immediatly reopen the new entry with child Users available. Because the child Users ishidden - and for a good reason.
I tried something like this but it doesn't reopen the new RowId
Could someone tell me if there's a better way to do this?
Right - you can't assign a user to a new site, since the new site doesn't have an ID until it is created. That id is needed to write into the database for the schema I've used there.
If you invert it, you can do something like this, but that might not be ideal for you.
Instead, what you could do is immediately edit a new site row when it is created as you've tried to do. I think you would actually need to use:
i.e. add the
#
to make it a DOM id selector. Otherwise Editor / DataTables will likely see a number and that is a data index selector in DataTables.Allan