简体   繁体   English

将jQuery插件树表与Knockoutjs结合使用

[英]Using jQuery Plugin Treetable with Knockoutjs

I am using knockout.js and want to use the jquery plugin treetable . 我正在使用基因敲除.js,并想使用jQuery插件树表 But I don't get it to work. 但是我不起作用。 Has someone build something similar using knockout.js and probably with this plugin? 是否有人使用敲门.js以及可能与此插件构建了类似的东西?

I was trying to integrate it using a bindingHandler: 我试图使用bindingHandler集成它:

<table data-bind="treetable: tasks, treeOptions: { initialState: 'expanded' } ">
  <tbody data-bind="foreach: tasks">
    <tr data-bind="attr: { 'data-tt-id': id, 'data-tt-parent-id': parentId }">
      <td data-bind="text: title"></td>
    </tr>
  </tbody>
</table>

See my full code here: http://jsfiddle.net/qhgfx0ff/1/ 在这里查看我的完整代码: http : //jsfiddle.net/qhgfx0ff/1/

Thanks for any hint or help! 感谢您的任何提示或帮助!

Cheers, TeeJay 干杯,TeeJay

We cannot directly use thirdparty plugins in knockout. 我们不能在淘汰赛中直接使用第三方插件。 We need to create a custom binding for them. 我们需要为它们创建一个自定义绑定。

Look at the section 看这节

Custom binding handlers 自定义绑定处理程序

in the link here which has integrating third party widgets in knockout. 此处的链接中,该链接已将第三方小部件集成到淘汰赛中。 You can use similar kind of logic here 您可以在此处使用类似的逻辑

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM