Best Way to manipulate autonumber
Best Way to manipulate autonumber
vincmeister
Posts: 136Questions: 36Answers: 4
in Editor
Hi Allan,
I want to insert an autonumber that generated by some format from database.
I already tried initSubmit
and preSubmit
to manipulate, but it wont work.
edtJobPosting.on( 'initSubmit', function ( e, action ) {
if (action == 'create'){
$.ajax( {
url: 'function/root/load_autonumber.php',
dataType: 'json',
type: 'POST',
data: {
table_name: 'thjob',
digit_surat: 12,
prefix_surat: '',
where: ''
},
success: function ( json ) {
edtJobPosting.field('thjob.kode').val(json);
}
} );
}
});
edtJobPosting.on( 'preSubmit', function ( e, data, action ) {
if (action == 'create'){
$.ajax( {
url: 'function/root/load_autonumber.php',
dataType: 'json',
type: 'POST',
data: {
table_name: 'thjob',
digit_surat: 12,
prefix_surat: '',
where: ''
},
success: function ( json ) {
data.data[0].thjob.kode = json
}
} );
}
});
on the both codes, my json returned value as expected, but doesn't inserted to the created row.
Please advise, thank you
Regards,
Danny
This discussion has been closed.
Answers
Hi Danny,
Can you show me the returned JSON and also the full initialisation for your DataTable (client-side) please?
Thanks,
Allan