Hi, the Question is describe in the Attachments, is any way to achieve?
regards
Yes - the select field type has an upload() method that you can use to dynamically assign the options that should appear in the options list.
select
upload()
Allan
Hi Allen, I means is there any way to edit table1 and select option is table2? (how to access another table in this editor)
my code example
db_table='products'; //table1 name db_table2='category'; //table2 name //###this editor is edit table1 var editor; // use a global for the submit and return data rendering in the examples editor = new $.fn.dataTable.Editor( { "ajax": { 'type': 'POST', 'url': 'php2/join_products.php',//table1 'data': { db_table: db_table, //db_table2: db_table2, // its any way to access table2? }, }, // "ajax": "php2/staff.php", // "ajax": "php2/join.php", "table": "#example", "fields": [ { "label": "productlevel:", "name": db_table+".productlevel" }, { "label": "categoryid:", "name": db_table+".categoryid", type: "select", options: [ // #### I need display table2 in here!!! #### { label: "cat1 (1)", value: "1" }, { label: "cat2 (2)", value: "2" }, { label: "cat3 (3)", value: "3" }, { label: db_table2+".categoryname", value: db_table2+".categoryname" }, // it's not work !!!! ] }, { "label": "productname:", "name": db_table+".productname" }, { "label": "productprice:", "name": db_table+".productprice" },
or how to store the join data to a global array?
You can get the data from table2 using rows().data() and pass that into the update() method I suggested. There is currently no option to display a DataTable in the Editor form. That is something I will introduce in future.
rows().data()
update()
It looks like you're new here. If you want to get involved, click one of these buttons!
Answers
Yes - the
select
field type has anupload()
method that you can use to dynamically assign the options that should appear in the options list.Allan
Hi Allen,
I means is there any way to edit table1
and select option is table2? (how to access another table in this editor)
my code example
or how to store the join data to a global array?
You can get the data from table2 using
rows().data()
and pass that into theupdate()
method I suggested. There is currently no option to display a DataTable in the Editor form. That is something I will introduce in future.Allan