【问题标题】:generate event on row button click and add icon? how to在行按钮单击并添加图标时生成事件?如何
【发布时间】:2015-06-30 11:54:25
【问题描述】:

这是我的 HTML 代码:

     <div id="grdCurrencies"
             data-selectable="true"
             data-role="grid"
             data-pageable=" true"
             data-sortable=" true"
             data-columns='[
              { "field": "CurrencyCode", "width": 100 },
                { "field": "CurrencyName", "width": 100 }  ,
                 { field:"", template:"<i "class=" fa fa-trash-o grid-icon" data-bind="click: destroy"">del<"/"i>" , "width":40 }]'
             data-bind="source: dsProduct, events: {change: OnGridActiveRowChanged} "
             style=" height :500px;width:35%;">
        </div>

template 字段中:&lt;a &gt;del&lt;a&gt;,我必须添加一个图标,并且还必须在链接中触发一个事件点击图标。我必须在点击时给出类和事件名称。我将如何做到这一点?

【问题讨论】:

    标签: javascript jquery asp.net kendo-grid kendo-mvvm


    【解决方案1】:

    在网格中添加data-template="mytemplate"属性,下面是模板的示例代码。这可能会奏效

    <script id="mytemplate" type="text/x-kendo-template">
        <tr>
            <td data-bind="text:CurrencyCode"></td>
            <td data-bind="text:CurrencyName"></td>
            <td class="text-center" width="13%">
                <i class="fa fa-trash-o" data-bind="click: removeRec"></i>
            </td>
        </tr>
    </script>
    

    【讨论】:

      猜你喜欢
      • 2018-06-16
      • 2013-07-03
      • 2020-03-02
      • 1970-01-01
      • 2014-05-26
      • 1970-01-01
      • 2014-11-11
      • 2022-09-30
      • 1970-01-01
      相关资源
      最近更新 更多