Skip to content
awj100 edited this page Nov 8, 2014 · 10 revisions

We have written some very simple JSFiddle examples to show knockout.groupedOptions in use.

All the examples use the same underlying data, but build slightly different view-models to represent this data.

Non-convention-based implementation: this example shows all of the parameters being specified.

Convention-based implementation: as explained in the documentation, if conventions are adopted then the data-bind syntax may be shortened considerably. Here is an example of a <select> element bound to a view-model which has implemented the conventions.

Non-observable implementation: as explained in the Notes section of the documentation, the groupedOptions binding need not be bound to observable properties. Here is an example of a <select> element bound to non-observable properties in a view-model. Note that this example also uses conventions to shorten the data-bind attribute.

Clone this wiki locally