【问题标题】:Kendo grid column data binding剑道网格列数据绑定
【发布时间】:2014-08-13 04:52:32
【问题描述】:

谁能展示如何使用“kendo.template”将以下脚本绑定到剑道网格中的一列?

<script id="edit" type="text/x-kendo-template">
    <div>
        <div data-bind="style: { color: 'red' }">
            Profit Information
        </div>
    </div>
</script>

【问题讨论】:

  • 为什么需要将它绑定到列?任何原因 ?如果你给个理由,我会有更好的选择

标签: user-interface data-binding kendo-ui grid


【解决方案1】:

如果您在网格中使用它,则不应使用data-bind,因为它已经绑定到模型。您应该直接将 HTML 用作:

<script id="edit" type="text/x-kendo-template">
    <div>
        <div style="color: red">
            Profit Information
        </div>
    </div>
</script>

在这里查看:http://jsfiddle.net/OnaBai/Ljsk8rk1/

【讨论】:

  • 嗨@OnaBai 我特别想要'data-bind="style: { color: 'red' }"',因为我有一个用敲除编写的自定义绑定,我想在这里绑定。 data-bind="style: { color: 'red' }" 写在那里只是为了便于理解。你有解决办法吗?
  • 在内部,扩展模板是一个接收两个参数的调用:与模板对应的字符串和绑定到模板的数据。对于 Grid,这是行。因此,数据绑定不适用,因为数据已经绑定,您可以(应该)直接使用它而没有任何其他问题。我仍然不明白为什么要使用数据绑定的样式实际上是一个常量。边界是可变的,你的风格是文字。
  • Thankx @OnaBai...为了问这个问题,我只放了风格的东西...那里有一个不同的淘汰赛绑定:)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-02-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-09-26
相关资源
最近更新 更多