Kendo按钮数据单击kendo网格模板内部无法正常工作

时间:2014-08-17 07:42:46

标签: javascript html kendo-ui kendo-grid kendo-mobile

我有这样的剑道网格。在这个模板中,我使用了按钮的数据点击属性,但事件根本没有触发。我不知道出了什么问题。

这是我的代码。任何人都可以提供帮助。

    $("#defect_grid_general").kendoGrid({
        dataSource: ELQApp.GeneralDefectStore,
        columns: [
                { field: "Name", title: "Component" },
                { field: "Opname", title: "Operation" },
                { field: "DefectDescription", title: "Defect" },               
                { field: "qty", title: "Qty", template: "<input type='text' readonly='readonly' id=#=ELQGeneralDefectInfoId# onclick='ELQApp.ELQViewModel.LaunchKeyPad(this.id,&quot;gen_defect&quot;)'  style='width:60px' value='#=DefectQty#' readonly=readonly/> <a id='decrement_qty' name='-' data-role='button' onmousedown = 'ELQApp.ELQViewModel.IncrementDecrementValuesBtn1(this.name,&quot;#:ELQGeneralDefectInfoId#&quot;,&quot;update&quot;)' class='km-button minusBtn'></a><a  data-role='button' data-name='+'  data-type=#=ELQGeneralDefectInfoId#  data-flag='update' id='increment_qty' data-click='ELQApp.ELQViewModel.IncrementDecrementValuesBtn' class='km-button plusBtn'></a>", width: "155px" },
                { field: "", title: "", template: "<button  data-click='ELQApp.ELQViewModel.RemoveGeneralDefect'>Delete</button>" },
                { field: "", title: "", template: "<input type='button' value='More Info' name=#=ELQGeneralDefectInfoId# onclick='ELQApp.ELQViewModel.OpenModal(&quot;more_info_popup&quot;,this.name,this)' id='rem'/>", width: "110px" },
                { field: "", title: "", template: "<a id =#=ELQGeneralDefectInfoId# onclick='ELQApp.ELQViewModel.RemoveGeneralDefect(this.id)' class='deleteBtn'></a>", width: "50px" }
        ],
        height: 220,
    });

1 个答案:

答案 0 :(得分:1)

Hey Chinthaka,

     <div id="test-grid" data-role="grid"  data-bind="source: testDataSource" 
     data-columns='[
            { 
                field: "Site",
                title: "Site"
            } , 
            { 
                title: "Action",
                template: kendo.template($("#conditional-action-template").html())

            }

        ]'></div>

<div id="log"></div>

  <script id="conditional-action-template" type="text/x-kendo-template">
# if(FirstActionEnabled) { #
<div class='action circle' data-bind="click: firstActionClick"></div>
# } #
# if(SecondActionEnabled) { #
<div class='action square' data-bind="click: secondActionClick"></div>
# } #
</script>

我给你小提琴链接..

Link- http://jsfiddle.net/falafelsoftware/B8ynX/

我希望你喜欢它..

如果你愿意,请不要忘记投票给我......