Hi
The 1st editor form uses the standard create, edit and remove extensions but form #2 gets called from a custom button. DT and editor form #1 share the same Ajax method. Form #2 has a different Ajax method that should not refresh the DT as the data it handles is different background data the user can edit but not see directly via the DT. He needs to click the custom button to view and edit that data. The forms handle data across 2 different tables who share the same foreign key.
var editor2 = ModifyCustomerSubPackSNsAssociations_editor();
(DT code)
buttons: [
{ extend: 'create', editor: editor1 },
{ extend: 'edit', editor: editor1 },
{ extend: 'remove', editor: editor1 },
{
text: '@(lblo.lblAssociatedSNs)',
extend: 'edit', editor: editor2
}
],
Code for ModifyCustomerSubPackSNsAssociations_editor:
function ModifyCustomerSubPackSNsAssociations_editor() {
var editor = new $.fn.dataTable.Editor({
destroy: true,
ajax: {
url: '/CustomerSubsPacks/CRUDCustomerSubsPacksSNs/',
data: function ( d ) {
return $.extend( {}, d, {
intContTpe: intContTpe1
} );
},
type: 'POST',
async: true,
cache: false
},
table: '#tblDataTable',
fields: [
{
label: '',
name: 'CustomerSubsPacksSNs.id'
}, {
label: '@(lblo.lblServiceNumbers):', //cdr formats and price lists don't show ticked when opening editor
name: 'CustomerSubsPacksSNs[].id', //SNs
type: "checkbox"
}
]
});
return editor;
}
How do I reference editor2 correctly? The form opens but ajax method CRUDCustomerSubsPacksSNs never gets hit when form opens. Browser console does not throw any errors. Thanks.