在wijmogr​​id列中单击复选框时传递列值

时间:2015-05-14 15:29:59

标签: angularjs wijmo

我想在wijmo网格列中使用ng-click of angular点击特定列时,将列值传递给函数。我将未定义为值。当为每行选中复选框时,我们如何传递关联的列值/行值。

我的代码:

HTML

<wj-flex-grid items-source="instances">
       <wj-flex-grid-column header="Select" >
                <input type="checkbox" binding = "machinename" ng-click= "model.funcall(args)"/>
        </wj-flex-grid-column>
        <wj-flex-grid-column header="Application" binding="appname" ></wj-flex-grid-column>
        <wj-flex-grid-column header="Server" binding="machine"></wj-flex-grid-column>
        <wj-flex-grid-column header="Instance" binding="instancename"></wj-flex-grid-column>
        <wj-flex-grid-column header="Last Updated" binding="lastupdated"></wj-flex-grid-column>
        <wj-flex-grid-column header="Status" binding="state"></wj-flex-grid-column>
        <wj-flex-grid-column header="Error" binding="error"></wj-flex-grid-column>
        </wj-flex-grid>

JS

$scope.model.funcall = function funcall(args){
            console.log("function called");
            console.log(args);

        }

1 个答案:

答案 0 :(得分:2)

您应该使用$ item替换args以获取该特定行的dataItem。这是代码:

input type =“checkbox”binding =“machinename”ng-click =“model.funcall($ item)”/&gt;

有关$ item的更多详细信息,请参阅以下doc链接: http://wijmo.com/5/docs/topic/wijmo.angular.WjFlexGridCellTemplate.Class.html