SELECT populate from Mysql
SELECT populate from Mysql
How can I populate a Select Box from a MySQL Source instex of static information.
Ex:
When I create a new record, the editor shows the varous fields including select elements. What I need is to fill the select options with database information rather than static one.
Best regards.
Ex:
When I create a new record, the editor shows the varous fields including select elements. What I need is to fill the select options with database information rather than static one.
Best regards.
This discussion has been closed.
Replies
[code]
editor.field('dept.id').update( json.dept );
[/code]
There is an example here:
http://editor.datatables.net/release/DataTables/extras/Editor/examples/join.html
Allan
Is there a way to extend this if you want to query from the dept table? As an example, you have a field called "status_id" in the table and you only want to include options where status_id=1. If I can't use this method for loading the select options and need to load via html, how do you set the "selected" option for an update.
Allan
[code]
$( editor.node( 'status_id' ) ).on( 'change', function () {
// Get and modify list of options
// ...
editor.field( 'dept.id').update( data );
} );
[/code]
Is that the kind of thing you are after?
Allan