Is there a way to use more than one nested type: "datatable" field in editor?
Is there a way to use more than one nested type: "datatable" field in editor?
I can successfully use one nested datatables field in editor. However, when I try to use 3, the data from the datatables fields are not passed to their respective editors. It's not an options pair issue because I can create a new record and use the nested datatables (all three of them) and select the values/items I want. But when I try to use the nested editor attached no data is passed.
I have a test case at but it is on a locked site, Allan, you have access to it already. rts.php where it's working with the 2nd and 3rd datatable instances remarked out. rts2.php , is what I want, but it will not return any data to the nested editors.
rts2.php "relevant part"
<script>
$(document).ready(function() {
var comradeEditor = new $.fn.dataTable.Editor( {
ajax: 'comradeNested.php',
fields: [ {
label: 'Contact ID:',
name: 'form.CR_ID',
type: 'hidden'
}, {
label: 'Prison ID:',
name: 'form.PrisonerID'
}, {
label: 'First Name:',
name: 'form.FirstName'
}, {
label: 'Last Name:',
name: 'form.LastName'
}, {
label: 'Preferred Name:',
name: 'form.PrefName'
}, {
label: 'Subscribed to the Abby:',
name: "form.IsAbby",
className: 'full block' ,
type: "radio",
options: [
{ label: "No", value: 0},
{ label: "Yes", value: 1}
],
def: 0
}, {
label: 'Prison Name:',
name: 'form.FAC_ID',
type: 'datatable'
}
],
bootstrap: {
floatingLabels: true
}
} );
var letterEditor = new $.fn.dataTable.Editor( {
ajax: 'letterNested.php',
fields: [ {
label: 'Letter ID:',
name: 'scanned_mail.id'
}, {
label: 'Orig Postmark:',
name: 'scanned_mail.postmark_date'
}, {
label: 'Scanned By:',
name: 'scanned_mail.scanner'
}, {
label: 'Answered By:',
name: 'scanned_mail.answered_by'
}, {
label: 'Printed By:',
name: 'scanned_mail.printed_by'
}, {
label: 'Date Printed:',
name: 'scanned_mail.date_printed'
}, {
label: 'Response Sent',
name: 'scanned_mail.response'
}, {
label: 'Resources Sent:',
name: 'scanned_mail.resources'
}
],
bootstrap: {
floatingLabels: true
}
} );
var facilityEditor = new $.fn.dataTable.Editor( {
ajax: 'facilityNested.php',
fields: [ {
label: 'Facility ID:',
name: 'PrisonFacilityListing.Facility_ID',
type: 'hidden'
}, {
label: 'Facility Type:',
name: 'PrisonFacilityListing.Facility_Type'
}, {
label: 'City:',
name: 'PrisonFacilityListing.City'
}, {
label: 'State:',
name: 'PrisonFacilityListing.State'
}, {
label: 'Phone:',
name: 'PrisonFacilityListing.Phone_Number'
}, {
label: 'Is mailing address Scanning Center?',
name: "PrisonFacilityListing.scanning_center",
className: 'full block' ,
type: "radio",
options: [
{ label: "No", value: 0},
{ label: "Yes", value: 1}
],
def: 0
}, {
label: 'Prison Name:',
name: 'PrisonFacilityListing.Prison_Name'
}, {
label: 'Mailing Addr 1:',
name: 'PrisonFacilityListing.Mail_Addr_1'
}, {
label: 'Mailing Addr 2:',
name: 'PrisonFacilityListing.Mail_Addr_2'
}, {
label: 'Mailing Addr 3:',
name: 'PrisonFacilityListing.Mail_Addr_3'
}, {
label: 'Mailing City:',
name: 'PrisonFacilityListing.Mail_City'
}, {
label: 'Mailing State:',
name: 'PrisonFacilityListing.Mail_State'
}, {
label: 'Mailing Zipcode:',
name: 'PrisonFacilityListing.Mail_Zip'
}
],
bootstrap: {
floatingLabels: true
}
} );
This question has an accepted answers - jump to answer
Answers
serverSide scripts
Thanks in advance
sorry darn thing made me break my code up
I think what is happening is as a result of the
editor
option for the Facility and the Letter configuration objects. They both have:editor: comradeEditor,
. It should be:And
for the facility field.
What appears to be happening is that the data for the facility is being written into the Comrade field, thus when you click edit, it can't find the data.
Hopefully, changing that will fix it. Let me know how you get on with it.
Allan
Crap. I swear I thought I had fixed that. Thanks, sorry for taking up your time. Appreciate the help.
No worries. An easy one to miss!
Allan