我正在尝试在这里使用演示:
http://knockoutjs.com/examples/cartEditor.html
但是,在使用的数据集中,即:sampleProductCategories - 在示例中它是静态的。
我想在通过 jQuery getJson 调用 API 后填充该数据集。
所以标记将存在于页面上 - 但是它还没有数据来填充视图。
当 sampleProductCategories 列表更改时,如何重新触发标记以重绘自身?
例如 - 这部分可以重绘/反弹到数据吗?
<tbody data-bind='foreach: lines'>
<tr>
<td>
<select data-bind='options: sampleProductCategories, optionsText: "TypeName", optionsCaption: "Select...", value: TypeID'></select>
</td>
<td data-bind="with: category">
<select data-bind='options: products, optionsText: "name", optionsCaption: "Select...", value: $parent.product'></select>
</td>
谢谢,
标记