lundi 19 août 2019

Kendo grid header template check box ng-click is not firing

I am adding checkbox in header template its getting added and check box getting checked unchecked but ng-click event is not firing can someone please look into this i am new to kendo ui

I have tried

ng-change 
ng-click = 'grid.appScope.toggleSelectAll($event)'

/.............................../enter code here

 $scope[$attrs.paiCheckColumns].unshift({
                template:
                    "<input type='checkbox' ng-model='dataItem.checked' ng-click='toggleSelectRow($event,dataItem)' />",
                headerTemplate:
                    "<input type='checkbox' title='Select all' ng-hide='_chk.singular' ng-model='_chk.all' ng-click='toggleSelectAll($event)' />",
                title: 'Select Items',
                width: '30px',
                isCheckBox: true
            });


$scope.toggleSelectAll = function(ev) {
        if (!isValid) {
            return;
        }

        var newState;
        var gridData = $scope._chk.mainData;
        var i, j, data, detIdx;

        if (ev === true) {
            //if this method is called programmatically
            newState = true;
            $scope._chk.all = true;
        } else {
            //ev is an event, so "all" is already changed via ng-model
            newState = ev.target.checked;
        }

        // empty ids in checked sets
        $scope._chk.items.splice(0, $scope._chk.items.length);
        if ($scope._chk.details) {
            $scope._chk.details.splice(0, $scope._chk.details.length);
        }
        // check all main rows
        if (gridData) {
            for (i = 0; i < gridData.length; i++) {
                gridData[i].checked = newState;
                if (newState) {
                    //add id to checked set
                    $scope._chk.items.push(gridData[i].id);
                }
                // check all sub-rows
                if (gridData[i].childDS) {
                    data = gridData[i].childDS.data();
                    for (j = 0; j < data.length; j++) {
                        data[j].checked = newState;
                        if (newState) {
                            //add id to checked set if not there
                            detIdx = $scope._chk.details.indexOf(data[j].id);
                            if (detIdx < 0) {
                                $scope._chk.details.push(data[j].id);
                            }
                        }
                    }
                }
            }
        }
    };

its not throwing any error




Aucun commentaire:

Enregistrer un commentaire