editor field - setting the current value when using a dropdown list
editor field - setting the current value when using a dropdown list
I have a number of fields where I use the join to populate the dropdown for the selection. However, the editor always defaults to the first item in the list. I know I can set the field to a value using the API but I need to get the currently selected data first. I tried using editor.get(); but this function only returns the first element in the dropdown list. How is this accomplished? Otherwise everything else is working great. Thanks for your help.
This discussion has been closed.
Replies
Regards,
Allan
I face the same issue I think....
That is on the EDIT form the drop down fields do NOT pick up the current field VALUE, rather as stated above they just default to the first value of the dropdown...
Just re read Allan's comment...Don't seem to understand the work around...?
As you'll be able to see in this example ( http://editor.datatables.net/release/DataTables/extras/Editor/examples/fieldTypes.html ) if you create a row and then go back to edit it, the `select` field is set to the correct value. Is that what you are having issues with?
Allan
Good spotting with the formOnlyData example. The reason that isn't working is that the 'title' information isn't actually included in the JSON data that I had:
[code]
{
"DT_RowId": "row_17",
"first_name": "Jessica",
"last_name": "Bryan",
"phone": "1-949-932-6772",
"city": "Boulder City",
"zip": "F5P 6NU",
"comments": "Nunc pulvinar arcu et pede. Nunc sed orci lobortis augue scelerisque mollis. Phasellus libero mauris, aliquam eu, accumsan sed, facilisis vitae,"
},
[/code]
The server-side for that example didn't reference the title at all!
Adding it in allows it to work correctly (which it now does).
Allan