Refael
Refael

Reputation: 7353

How to use Kendo-grid into Angular-ngRepeat

How to produce kendo-grid with different data for each iteration of ng-repeat ?

HTML code:

<div ng-repeat="PricesPerGroup in AllGroups">
    <kendo-grid options="GridOptions"></kendo-grid>
</div>

JavaScript code:

$scope.GridOptions = {
    dataSource: {
        data: {
            (data is current 'PricesPerGroup' - Should bring it from ng-repeat)
        }
    }
}

Upvotes: 3

Views: 1219

Answers (1)

dfsq
dfsq

Reputation: 193311

Try to use helper function that would return proper config object:

<div ng-repeat="PricesPerGroup in AllGroups">
    <kendo-grid options="getGridOptions(PricesPerGroup)"></kendo-grid>
</div>

And in controller:

$scope.getGridOptions = function(data) {
    return {
        dataSource: {
            data: data
        }
    };
};

Demo: http://dojo.telerik.com/eFaXA

Upvotes: 7

Related Questions