Standalone editor load ajax
Standalone editor load ajax
borconi
Posts: 56Questions: 19Answers: 1
Hi.
How can I load ajax data for a standalone editor?
manual_upload = new $.fn.dataTable.Editor( {
ajax: "manual_upload.php",
table: "#none",
fields: [ {
label: "Company:",
name: "company",
type:"readonly"
}, {
label: "Location:",
name: "short_add",
type:"readonly"
},
{
label: "Job:",
name: "long_description",
type:"readonly"
},
{
label: "Rep. pos.:",
name: "rep_pos",
type:"select"
},
{
label: "Rep. name:",
name: "rep_pos_name"
}
]
} );
.....
manual_upload.s.ajax='./manual_upload.php?schid='+schedule_id;
manual_upload.buttons( [{
label: "Close",
fn: function () {
manual_upload.close();
return false;
}}]);
manual_upload.title("Manual Upload");
manual_upload.edit();
This opens the editor correctly but the data is never populated.
I need to have it in a standalone environment so it's not associated to any table. Do I need to manually make a ajax call?
Thank you.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi "borconi",
Any luck on this subject?
Thank's!
Editor won't load data when an editing action is triggered (that is something that might come in a future version). Instead, the data must already be at the client-side. In the case of a standalone Editor, that means that it needs to be in the HTML. The documentation for this is available here.
Allan
Sorry haven't logged in for a few days so I didn't see the comments.
I workaround the limitation by using an ajax call and manually populating the fields, which is triggered by the editor "open" event something like this:
Not the most elegant but it works.