-The names jqAutoSource, etc. are all just names that I made up trying to be descriptive about what they contain. jqAutoSourceLabel, jqAutoSourceInputValue, and jqAutoSourceValue should all contain the name of the property that you want to use. I wanted to make it generic, so that it was flexible and fairly robust.
-I was tired of seeing ko.utils.unwrapObservable and it was making it hard to read, so I just created a shortcut "unwrap".
-the allBindingsAccessor function that is passed into a binding gives you access to all of the bindings that were in the same data-bind. So, I am in the "jqAuto" binding, but I am grabbing the values for all of the other bindings that were with it (jqAutoSource, jqAutoValue, etc.).
-the initial code just sets up the variables that we are need from the additional bindings and tries to enforce some defaults (if you don't say what property to use for your label, then we just default to the property that you said for the value). By the time we get through this, we should know where to get our source items from, where to read/write the value to, and which properties to use for the label, input value, and value.
-For the mappedSource: we are passed a source and are going to build a structure from it that jQuery autocomplete likes (label and value properties). I also added the "actualValue" property (arbitrary name), so that we have access to the real thing that we want to store on our model (the GUID for you). Then, when someone makes a selection, you have access to that object (with label, value, and actualValue). The reason that I played with putting this in a dependentObservable instead of just doing it in the update method was to try to separate the updates that happen when the value is updated vs. when the options are updated. For example, when using the options binding with the value binding on a select element, every time that the value is updated, the options are re-evaluated as well. This can cause performance problems. So, I put this in a dependentObservable, so that if the items that makes up the choices change, jQuery autocomplete will have an accurate list of options. The update method has the logic for handling the case that the model value was updated (either set initially or programmatically changed, so in your case the GUID is changed by something other than this box).
So, here are the tasks that I was trying to accomplish:
1- initialize the autocomplete with appropriate options (including a proper source array with label & value)
2- handle what happens when someone makes a selection (update the model value with the appropriate value)
3- handle someone entering bogus text into the box (when change event fires, try to see if the input value seems valid)
4- handle when the underlying options are updated (need to rebuild the source array and give the new structure to autocomplete)
5- handle when the value is updated elsewhere (initially set or programmatically changed). For example, you set the GUID to something else programmatically, we need to find the appropriate item and set the input value to the name.