When working with knockout and drop-down lists (combo-boxes) you might get following error.
SCRIPT28: Out of stack space
jquery-1.7.2.min.js, line 2 character 22680
This seems to be knockout framework bug or it is by design. Whatever the case is, the issue can be described as follows. Assume, you have a model like this one:
{
"MyPropertyOk": null,
"MyPropertyBad": ko.observable(“”)
}
Usually, you need to define all properties as observable. To demonstrate this issue, I have two properties. First one is not observable (MyPropertyOK) and second one is observable (MyPropertyBad).
To bind them I used two combo boxes:
<select id="comboOk" data-bind="value: MyPropertyOk">
<option value="1">Jedan</option>
<option value="2">Dva</option>
<option value="3">Tri</option>
<option value="4">Cetiri</option>
</select>
<select id="comboBad" data-bind="value: MyPropertyBad">
<option value="1">Jedan</option>
<option value="2">Dva</option>
<option value="3">Tri</option>
<option value="4">Cetiri</option>
</select>
If you start this code, the error shown above will be thrown. The error is caused by MyPropertyBad. To make this working, you model has to look like:
{
"MyPropertyOk": null,
"MyPropertyBad": null
}
Hope this will save a bit of your time.
Posted
Jun 13 2012, 02:14 PM
by
Damir Dobric