jsfiddle中的基因敲除JS映射模板嵌套数组 [英] knockoutJS mapping template nested arrays in jsfiddle

查看:78
本文介绍了jsfiddle中的基因敲除JS映射模板嵌套数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个小提琴:

http://jsfiddle.net/gY2JV/63/

为什么不显示数据?

推荐答案

有几处应更改:

vm = new DocsVM({
    MyDocs: ko.mapping.fromJS(jsonData)
});

当DocsVM进行另一个映射时,为什么在这里进行映射?

Why do the mapping here when DocsVM does another mapping?

vm = new DocsVM(jsonData);


模板名称必须用引号引起来


Template names need to be in quotation marks:

template: {name: TrTemplate

=>

template: {name: 'TrTemplate'


这不是有效的绑定:


This is not a valid binding:

<a data-bind="html:  'DisplayName

=>

<a data-bind="text: DisplayName


另一个说明:为什么要使用jQuery绑定按钮的事件处理程序?为此,请使用剔除法.


Another note: Why do you bind the event handler for the button using jQuery? Use knockout for that, for the sake of consistency.

http://jsfiddle.net/gY2JV/64/

这篇关于jsfiddle中的基因敲除JS映射模板嵌套数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆