Hello,
I have the case where some of my editable data elements must be chosen from a drop-down list whose options are driven by external data. I have tried many different variations at accomplishing this with MVVM and have so far been unsuccessful. I've gotten edit and delete to work, as this simplified fiddle shows:
http://jsfiddle.net/D2maN/22/
but am stuck at the creation of new records. The problem is, I have no prior knowledge of the data in the dropdown so cannot hard-code default values in the schema. What I tried in that fiddle is creating a temporary, dummy default value to avoid the error, but now the problem is that if the user clicks "Add new record", and then just clicks "Update" right away (without changing the combobox), that dummy default gets saved (which in the real world breaks my application server-side because it's an invalid choice).
I have a lot of control over most aspects of this, so am open to any recommended approach for handling this case. I've looked through all of the demos a number of times but have been unable to locate one with this situation. The most promising theory I've though of so far is trying to find an event that I can use to programatically select the first element of the combobox in such a way as to actually update the viewModel right when the popup opens, but I can't seem to figure out how to do that. But, again, any way that works is fine with me...
Any thoughts or help would be greatly appreciated.
Thanks,
--Dan
I have the case where some of my editable data elements must be chosen from a drop-down list whose options are driven by external data. I have tried many different variations at accomplishing this with MVVM and have so far been unsuccessful. I've gotten edit and delete to work, as this simplified fiddle shows:
http://jsfiddle.net/D2maN/22/
but am stuck at the creation of new records. The problem is, I have no prior knowledge of the data in the dropdown so cannot hard-code default values in the schema. What I tried in that fiddle is creating a temporary, dummy default value to avoid the error, but now the problem is that if the user clicks "Add new record", and then just clicks "Update" right away (without changing the combobox), that dummy default gets saved (which in the real world breaks my application server-side because it's an invalid choice).
I have a lot of control over most aspects of this, so am open to any recommended approach for handling this case. I've looked through all of the demos a number of times but have been unable to locate one with this situation. The most promising theory I've though of so far is trying to find an event that I can use to programatically select the first element of the combobox in such a way as to actually update the viewModel right when the popup opens, but I can't seem to figure out how to do that. But, again, any way that works is fine with me...
Any thoughts or help would be greatly appreciated.
Thanks,
--Dan