如何在knockout.js中创建三个嵌套列表?
我正在使用以下代码,但它会出错:
未捕获的TypeError:无法处理绑定
"foreach: function (){return ClauseLineModels }" Message: Unable to process binding "options: function (){return $parent.OperatorsId()[ClauseFieldsId()][ClauseInternalFieldsId()] }"
消息:无法读取未定义的属性“未定义”
<select data-bind="options : $parent.OperatorsId()[ClauseFieldsId()]
[ClauseInternalFieldsId()],optionsText : function(item) { return $parent.DataBase()
[ClauseFieldsId()].ClauseInternalFieldses()[ClauseInternalFieldsId()].Operators()
[item].NameFa(); },value : OperatorId,optionsCaption : 'Select...'" style="width: 100%;"> </select>
我只想创建两个嵌套列表。但是我没有给出三个列表。怎么做?
两个嵌套列表:
data-bind="options : $parent.ClauseInternalFieldsId()[ClauseFieldsId()],optionsText :
function(item) { return $parent.DataBase()[ClauseFieldsId()].ClauseInternalFieldses()
[item].NameFa(); },value : ClauseInternalFieldsId,optionsCaption : 'Select ...'"
我的清单:
public List<int> ClauseFieldsId { get; set; }
public List<List<int>> ClauseInternalFieldsId { get; set; }
public List<List<List<int>>> OperatorsId { get; set; }
我使用:knockoutmvc.com