Parent / child editing with Editor doesn't store parent id
Parent / child editing with Editor doesn't store parent id
paintitblack
Posts: 60Questions: 20Answers: 0
Hello,
I used this example https://datatables.net/blog/2016-03-25 and when I create a new child entry the new chield entry doesn' store the parent id. This makes the link between parent and child entry impossible.
Is it a common bug or did I something wrong? Should I post my complete source code?
Kind regards
Patrick
This question has accepted answers - jump to:
This discussion has been closed.
Answers
Parent Child works. Please post your code for review.
One key area is to have the child table setup with the properly for the ajax post. For example.
```
ajax: {
url: '/your_url_here',
type: 'post',
data: function ( d ) {
var selected = table.row( { selected: true } );
```
Kevin
The other key part, in addition to what Kevin has mentioned, is where the default is set for the child Editor, which it sounds like might be missing from your own code:
That will set the value that will be submitted when the new row is created.
Allan
Perfect I got it :-)
My bug was here:
.field( 'users.site' )
I thought that users is linked to this table
<table id="users" ...>
but it the link to mysql table (where I changed the name).
Thank you both very much
Patrick